diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-04-04 17:33:36 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-04-05 12:36:36 +0100 |
commit | 632bbbfe1cc49ab92c6de858865ffcdcfa67635f (patch) | |
tree | fa6a13ae99b4abd1e8328b99c5fa370c65c879d2 /actionpack | |
parent | 1ab7c37671d7c0cd9d8698bd462916a7e6f95470 (diff) | |
download | rails-632bbbfe1cc49ab92c6de858865ffcdcfa67635f.tar.gz rails-632bbbfe1cc49ab92c6de858865ffcdcfa67635f.tar.bz2 rails-632bbbfe1cc49ab92c6de858865ffcdcfa67635f.zip |
Merge docrails
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/base.rb | 5 | ||||
-rw-r--r-- | actionpack/lib/action_controller/url_rewriter.rb | 22 |
2 files changed, 9 insertions, 18 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index c6dd99e959..0b58c38fb5 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -408,7 +408,7 @@ module ActionController #:nodoc: # Return an array containing the names of public methods that have been marked hidden from the action processor. # By default, all methods defined in ActionController::Base and included modules are hidden. - # More methods can be hidden using <tt>hide_actions</tt>. + # More methods can be hidden using <tt>hide_action</tt>. def hidden_actions read_inheritable_attribute(:hidden_actions) || write_inheritable_attribute(:hidden_actions, []) end @@ -1338,6 +1338,7 @@ module ActionController #:nodoc: end end + # Returns true if a render or redirect has already been performed. def performed? @performed_render || @performed_redirect end @@ -1346,6 +1347,7 @@ module ActionController #:nodoc: @action_name = (params['action'] || 'index') end + # Returns a set of the methods defined as actions in your controller def action_methods self.class.action_methods end @@ -1372,6 +1374,7 @@ module ActionController #:nodoc: @request_origin ||= "#{request.remote_ip} at #{Time.now.to_s(:db)}" end + # Returns the request URI used to get to the current location def complete_request_uri "#{request.protocol}#{request.host}#{request.request_uri}" end diff --git a/actionpack/lib/action_controller/url_rewriter.rb b/actionpack/lib/action_controller/url_rewriter.rb index bb6cb437b7..16720b915b 100644 --- a/actionpack/lib/action_controller/url_rewriter.rb +++ b/actionpack/lib/action_controller/url_rewriter.rb @@ -68,29 +68,17 @@ module ActionController # This generates, among other things, the method <tt>users_path</tt>. By default, # this method is accessible from your controllers, views and mailers. If you need # to access this auto-generated method from other places (such as a model), then - # you can do that in two ways. - # - # The first way is to include ActionController::UrlWriter in your class: + # you can do that by including ActionController::UrlWriter in your class: # # class User < ActiveRecord::Base - # include ActionController::UrlWriter # !!! + # include ActionController::UrlWriter # - # def name=(value) - # write_attribute('name', value) - # write_attribute('base_uri', users_path) # !!! + # def base_uri + # user_path(self) # end # end # - # The second way is to access them through ActionController::UrlWriter. - # The autogenerated named routes methods are available as class methods: - # - # class User < ActiveRecord::Base - # def name=(value) - # write_attribute('name', value) - # path = ActionController::UrlWriter.users_path # !!! - # write_attribute('base_uri', path) # !!! - # end - # end + # User.find(1).base_uri # => "/users/1" module UrlWriter def self.included(base) #:nodoc: ActionController::Routing::Routes.install_helpers(base) |