Tuesday, 15 February 2011

ruby on rails - Modify Sign Up Path Devise -



ruby on rails - Modify Sign Up Path Devise -

i want redirect user specific page based on sign within application. example, if sign /users/sign_up you'll directed homepage, if sign sign form /users/1 want redirect user's profile after sign up. possible devise?

try bellow :

class applicationcontroller < actioncontroller::base before_filter :remember_my_last_path def after_sign_up_path_for resource if cookies[:last_path].blank? super else cookies[:last_path] end end private def remember_my_last_path cookies[:last_path] = request.fullpath end end

in way set hash value last_path cookies , phone call in every controller. when click on register, phone call devise method after_sign_up method overrided, , send user specific path or default path .

hope help .

ruby-on-rails ruby devise

No comments:

Post a Comment