From: Lake Denman Date: 2011-08-30T14:03:50+09:00 Subject: Re: Redirecting to referer page after the sign up? I'm not sure if this will work, but it is the best I can do at the moment: http://ykyuen.wordpress.com/2011/03/10/rails-redirect-previous-page-after-devise-sign-in/ You'll be better off asking the ruby on rails, I think. On Aug 29, 2011, at 6:33, Hussam Ali wrote: > Im trying to redirect the user after the sign up by saving the referer > in case when user came to sign up through clicking on any specific page. > But its not working properly. > > I'm using Devise, and i have 2 step registration, after sign up user > redirects to profile completion and it is mandatory and after that im > redirecting to referer. Please tell me what is the problem ? > > In my application controller, > > before_filter : save_referer > > def save_referer > unless user_signed_in? > unless session['referer'] > session['referer'] = request.referer || 'none' > end > end > end > > In User Model, > > def save_with(referer) > referer = referer unless referer == "null" > self.save > end > > Initally i did self.referer but then i got undefined method `referer=' > for # > > Here im saving it, > > if current_user.sign_in_count <= 1 > if current_user.save_with(session[:referer]) > redirect_to session[:referer] > else > redirect_to any_other > end > end > > -- > Posted via http://www.ruby-forum.com/. >