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
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.
By default it's the first devise role declared in your routes
devise :users # resource is instance of User class
devise :admins # resource is instance of Admin class
Alex's answer says it succintly, but it may not be clear to everyone, given the comment above:
The authors of devise realise that those who user the gem will want it customised differently. Some people will want to call their users: Users, others will want to call them: Swimmers, or Golfers, or Presidents, as the case may be. "Resource" is basically a substitute for the name of the users that app developers will utilize in the future. devise doesn't care what users are actually called: no matter what it is called, to devise, your users will be known as simply "resource". If it had been any other way, then the authors of the gem would have to force app developers to call their users: Administrator, or Admin - which is very restrictive and developers will not like that.