aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/helpers.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2008-05-02 14:45:23 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-05-02 14:45:23 +0100
commit64092de25727c1943807bf5345107d90428135a0 (patch)
tree87977e3b0c839fb6adb417949676bb5384155526 /actionpack/lib/action_controller/helpers.rb
parent87ec72bd8c4b5d178ba7a41e605bc9a8e27f9e67 (diff)
downloadrails-64092de25727c1943807bf5345107d90428135a0.tar.gz
rails-64092de25727c1943807bf5345107d90428135a0.tar.bz2
rails-64092de25727c1943807bf5345107d90428135a0.zip
Improve documentation coverage and markup
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'actionpack/lib/action_controller/helpers.rb')
-rw-r--r--actionpack/lib/action_controller/helpers.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/helpers.rb b/actionpack/lib/action_controller/helpers.rb
index 9188f94f37..a8bead4d34 100644
--- a/actionpack/lib/action_controller/helpers.rb
+++ b/actionpack/lib/action_controller/helpers.rb
@@ -143,11 +143,19 @@ module ActionController #:nodoc:
# Declare a controller method as a helper. For example, the following
# makes the +current_user+ controller method available to the view:
# class ApplicationController < ActionController::Base
- # helper_method :current_user
+ # helper_method :current_user, :logged_in?
+ #
# def current_user
- # @current_user ||= User.find(session[:user])
+ # @current_user ||= User.find_by_id(session[:user])
# end
+ #
+ # def logged_in?
+ # current_user != nil
+ # end
# end
+ #
+ # In a view:
+ # <% if logged_in? -%>Welcome, <%= current_user.name %><% end -%>
def helper_method(*methods)
methods.flatten.each do |method|
master_helper_module.module_eval <<-end_eval