Scroll down to Configuring controllers. Essentially, you will want to create
a controller that extends Devise's RegistrationsController like this:
class Users::RegistrationsController < Devise::RegistrationsController
def after_sign_in_path_for(resource)
user_thank_you_path
end
End
What you're doing is overwriting the after_sign_in_path for the
RegistrationsController.
Make sure to copy the Devise views from devise/registrations/edit.html.erb
and devise/registrations/new.html.erb to users/registrations/edit.html.erb
and users/registrations/new.html.erb
You will also want to do something like this in your routes:
devise_for :users, :controllers => { :registrations => "users/sessions" }
Hope that helps you out.
Chris Your
def create
build_resource
if resource.save
set_flash_message :notice, :signed_up
sign_in(resource_name, resource)
redirect_to params[:after_sign_up_path] ||
after_sign_in_path_for(resource)
else
clean_up_passwords(resource)
render_with_scope :new
end
end
That should get you started... unless José has a better idea.
Chris Your
http://wiki.github.com/plataformatec/devise/howto-redirect-to-a-specific-page-on-successful-sign-in
Walter
On Jun 2, 2010, at 11:54 AM, Christopher Your / Ignition Industries
wrote:
###ApplicationController
def stored_location_for( resource )
if current_user
Rails.logger.info "count: " + current_user.sign_in_count.to_s
if current_user.sign_in_count <= 1
UserMailer.deliver_first_visit(current_user)
elsif ( current_user.first_name.blank? ||
current_user.last_name.blank? || current_user.phone.blank? ||
current_user.company_name.blank? )
set_flash_message :notice, 'Please update your profile'
return '/users/' + current_user.id.to_s + '/edit'
end
end
super( resource )
end
Not pretty, but it works for what I need to do.
Walter
On Jun 2, 2010, at 11:54 AM, Christopher Your / Ignition Industries
wrote:
>>> Make sure to copy the Devise views from devise/registrations/
>>> edit.html.erb
>>> and devise/registrations/new.html.erb to users/registrations/
>>> edit.html.erb