If you have a model ‘user’ generated through restful_authentication
generator, then you should have an accessor
@current_user ||= …
inside the file authenticated_system.rb in lib folder. If you did as
it is recommended and put ‘include AuthenticatedSystem’ in
ApplicationController, then now you have an access to the method
‘current_user’ in any view. The same for method ‘logged_in?’.
Now try doing the same for method ‘login_required’, which is also
inside of AuthenticatedSystem module. Doesn’t work. Reads “undefined
local variable or method ‘login_required’”.
Summing up, both ‘logged_in?’ and ‘login_required’ are inside of
Authenticated System module. ‘logged_in?’ is accessible from any view,
while ‘login_required’ is not.
What’s the difference?