Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Weird delayed_job behaviour
- class User < ActiveRecord::Base
- devise :database_authenticatable, :registerable,
- :recoverable, :rememberable, :trackable, :validatable
- attr_accessible :email, :password, :password_confirmation, :remember_me, :country, :phone_number, :opt_in
- def email=(email)
- super
- Delayed::Job.enqueue self
- end
- def perform
- begin
- UserMailer.welcome_email self
- rescue => e
- STDERR.puts "Cannot perform the mailer: #{e}"
- end
- end
- end
- def create
- user = User.new({:email => params[:email],
- :password => params[:password],
- :password_confirmation => params[:password_confirmation],
- :country => params[:country],
- :opt_in => Boolean(params[:opt_in]),
- :phone_number => params[:phone_number]})
- if user.save(:validate => false)
- redirect_to wrap_users_path
- end
- end
Add Comment
Please, Sign In to add comment