Displaying 2 results from an estimated 2 matches for "stored_location_for".
2011 Jun 05
1
Cancan redirect back at AccessDenied
...I can''t really understand why there is no http_referer, how is back
button working on views? Is it possible to implement a general back
action for the cancan access denied exception?
I like the devise approach of "back" method after sign in:
def after_sign_in_path_for(resource)
stored_location_for(resource)
end
It would be perfect if I could combine them.
Thank you!
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To u...
2011 Nov 02
1
getting devise to return json data when signing out
...def sign_in_and_redirect(resource_or_scope, resource=nil)
scope = Devise::Mapping.find_scope!(resource_or_scope)
resource ||= resource_or_scope
sign_in(scope, resource) unless warden.user(scope) == resource
return render :json => { :success => true, :redirect =>
stored_location_for(scope) || after_sign_in_path_for(resource)}
end
def failure
return render :json => {:success => false, :errors => ["Login
failed."]}
end
def logged_in
return render :json => {:success => false, :errors => ["Already
logged in."]}
end...