Skip to content

Instantly share code, notes, and snippets.

@jccarbonfive
Created January 7, 2012 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jccarbonfive/1575869 to your computer and use it in GitHub Desktop.
Save jccarbonfive/1575869 to your computer and use it in GitHub Desktop.
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