Skip to content

Instantly share code, notes, and snippets.

@YuriFontella
Last active November 10, 2015 01:38
Show Gist options
  • Save YuriFontella/75c43d631cf06b47882f to your computer and use it in GitHub Desktop.
Save YuriFontella/75c43d631cf06b47882f to your computer and use it in GitHub Desktop.
Form/Mail/Rails
# Formulário
<%= form_tag invites_path, class: 'ui invite' do %>
<div class="ui action input" style="width:45%">
<%= text_field_tag 'email', nil, placeholder: "E-mail..." %>
<div class="ui icon button refresh" type="submit"><i class="mail icon"></i></div>
</div>
<% end %>
# Controller
class InvitesController < ApplicationController
def create
@email = params[:email]
InviteMailer.send(@email).deliver_later
redirect_to root_path
end
end
# Mailer
class InviteMailer < ApplicationMailer
default from: 'noreply@wiblisten.com'
def send(email)
@email = email
mail(to: @email, subject: 'Wiblisten | Convite')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment