Created
January 7, 2012 20:10
-
-
Save jccarbonfive/1575869 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class UsersController < ApplicationController | |
def create | |
@user = User.new params[:user] | |
@user.save | |
respond_to do |format| | |
format.html do | |
EmailService.send_welcome_email user | |
redirect_to @user | |
end | |
format.json do | |
render :json => @user, | |
:status => :created, | |
:location => @user | |
end | |
end | |
end | |
end | |
class EmailService | |
def self.send_welcome_email(user) | |
email = UserMailer.welcome_email user | |
email.deliver | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment