ruby on rails - Manually setting return_to with devise -
i using devise authenticate users on app. it's working great point, having trouble specific action:
view:
<p id="save"><%= link_to "save", new_save_path, :remote => true %></p>
saves_controller.rb:
def new if user_signed_in? @save = save.create(:user_id => current_user.id) render :update |page| page.replace_html "save", "saved!" end else redirect_to new_user_session_path, :notice => "you need sign in that." end end
as can see, because action ajax one, can't use traditional before_filter :authenticate_user!
method. instead redirecting user sign in page.
the problem is, want automatically redirect user previous page when logged in.
i understand can session[:"user.return_to"]
i'm having trouble setting it. how can this? or going wrong?
i believe session key :"#{scope}_return_to
, :user_return_to
user
class.
Comments
Post a Comment