Friday, 2 August 2013

device redirect back when user login

class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def after_sign_in_path_for(resource)
sign_in_url = url_for(:action => 'new', :controller => 'sessions', :only_path => false, :protocol => 'http')
if request.referer == sign_in_url
super
else
stored_location_for(resource) || request.referer || root_path
end
end
end
view raw gistfile1.rb hosted with ❤ by GitHub

No comments:

Post a Comment