Jeremy Jeremy - 5 days ago 6
Ruby Question

What does resource mean in Devise?

I want to change what happenes in devise when a user logs in.. When I look at the source code the word resource is everywhere, but I can't understand what it is a stand in for. Does it only pertain to devise and warden?

def after_sign_in_path_for(resource)
stored_location_for(resource) ||
if resource.is_a?(User) && resource.can_publish?
publisher_url
else
super
end
end

Answer

Resource is an abstraction name of instance of a user. It can be configured in devise settings to work with Admin model or any other.

Comments