Last active
November 10, 2015 01:38
-
-
Save YuriFontella/75c43d631cf06b47882f to your computer and use it in GitHub Desktop.
Form/Mail/Rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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