From 3f22b5813afd54eb1a3b7b2d4137eca019196e64 Mon Sep 17 00:00:00 2001 From: jianlin Date: Mon, 28 Feb 2011 16:48:15 -0800 Subject: [PATCH] edited module docs --- generators/authenticated/templates/authenticated_system.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/generators/authenticated/templates/authenticated_system.rb b/generators/authenticated/templates/authenticated_system.rb index 6e1bd18..648a24d 100644 --- a/generators/authenticated/templates/authenticated_system.rb +++ b/generators/authenticated/templates/authenticated_system.rb @@ -6,8 +6,11 @@ def logged_in? !!current_<%= file_name %> end - # Accesses the current <%= file_name %> from the session. - # Future calls avoid the database because nil is not equal to false. + # Returns the current logged in <%= file_name %>. Note that it is a <%= file_name %> object if there is a logged in <%= file_name %> + # Return nil if there is no current logged in user. (regardless @current_<%= file_name %> may be false, current_<%= file_name %> returns nil) + # + # Note that any call to get the current logged in user should use current_<%= file_name %>, and never use @current_<%= file_name %> + # When @current_<%= file_name %> is set to false, it will avoid any trip to the DB def current_<%= file_name %> @current_<%= file_name %> ||= (login_from_session || login_from_basic_auth || login_from_cookie) unless @current_<%= file_name %> == false end