Let me first ask a question: How do I go through the options during the Devise login process?
Now the rest ...
I am trying to implement the following functions in my Rails 3 application.
I have a collection of users, each with its own profile page. I want them to be able to view their own profile page, but not one of the other user's profile pages, unless they are administrators, in which case they have access to everything in the application.
I created a user controller and applied the following code to the start of the controller (for the record I replaced, search by id with their username, so that / users / username to access the profile):
filter_access_to :all do
current_user == User.find_by_username(params[:id]) or
has_role? :admin
end
... and I pointed to route.rb:
root :to => "users#show"
, URL-: http://appli.cat.ion, , root_path . : id , . - , ? , .
,
№ 1. -, . , , , Devise :
after_sign_in_path_for(resource)
stored_location_for(resource)
after_sign_in_path :
def after_sign_in_path_for(resource)
user_root_path(:id => current_user.username)
end
( , ), nil stored_location_for, :
def stored_location_for(resource)
nil
end
, , - , (http)://appli.cat.ion/, , , . , , (http)://appli.cat.tion/otherresources, , . nil stored_location_for, , . , , , stored_location nil , root_path. , ...