From e3b3f416b57f5642ea25078485f7e9394ad04526 Mon Sep 17 00:00:00 2001 From: Nick Sutterer Date: Thu, 12 May 2011 09:31:36 +0200 Subject: added docs for AbC::UrlFor and AC::UrlFor. --- actionpack/lib/action_controller/metal/url_for.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'actionpack/lib/action_controller/metal/url_for.rb') diff --git a/actionpack/lib/action_controller/metal/url_for.rb b/actionpack/lib/action_controller/metal/url_for.rb index 6fc0cf1fb8..9a03033f48 100644 --- a/actionpack/lib/action_controller/metal/url_for.rb +++ b/actionpack/lib/action_controller/metal/url_for.rb @@ -1,3 +1,9 @@ +# Includes #url_for into the host class. The class has to provide a RouteSet by implementing +# the #_routes methods. Otherwise, an exception will be raised. +# +# In addition to AbstractController::UrlFor, this module accesses the HTTP layer to define +# url options like the +host+. In order to do so, this module requires the host class +# to implement #env, which needs to be a Rack-compatible environment hash. module ActionController module UrlFor extend ActiveSupport::Concern -- cgit v1.2.3 From e1ceae576e3911f3e6708b5d19a0e3ef63769eb7 Mon Sep 17 00:00:00 2001 From: Nick Sutterer Date: Thu, 12 May 2011 09:58:26 +0200 Subject: added an example for AC::UrlFor usage to make usage simpler. --- actionpack/lib/action_controller/metal/url_for.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_controller/metal/url_for.rb') diff --git a/actionpack/lib/action_controller/metal/url_for.rb b/actionpack/lib/action_controller/metal/url_for.rb index 9a03033f48..a185d799bf 100644 --- a/actionpack/lib/action_controller/metal/url_for.rb +++ b/actionpack/lib/action_controller/metal/url_for.rb @@ -3,7 +3,19 @@ # # In addition to AbstractController::UrlFor, this module accesses the HTTP layer to define # url options like the +host+. In order to do so, this module requires the host class -# to implement #env, which needs to be a Rack-compatible environment hash. +# to implement #env and #request, which need to be a Rack-compatible. +# +# Example: +# +# class RootUrl +# include ActionController::UrlFor +# include Rails.application.routes.url_helpers +# delegate :env, :request, :to => :controller +# +# def initialize(controller) +# @controller = controller +# @url = root_path # named route from the application. +# end module ActionController module UrlFor extend ActiveSupport::Concern -- cgit v1.2.3 From e5524d538c0d0f39d655a78fc45d2122c0ff2f2a Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sat, 14 May 2011 11:15:43 +0200 Subject: minor edits after going through what's new in docrails --- actionpack/lib/action_controller/metal/url_for.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'actionpack/lib/action_controller/metal/url_for.rb') diff --git a/actionpack/lib/action_controller/metal/url_for.rb b/actionpack/lib/action_controller/metal/url_for.rb index a185d799bf..08132b1900 100644 --- a/actionpack/lib/action_controller/metal/url_for.rb +++ b/actionpack/lib/action_controller/metal/url_for.rb @@ -1,21 +1,24 @@ -# Includes #url_for into the host class. The class has to provide a RouteSet by implementing -# the #_routes methods. Otherwise, an exception will be raised. +# Includes +url_for+ into the host class. The class has to provide a +RouteSet+ by implementing +# the _routes method. Otherwise, an exception will be raised. # -# In addition to AbstractController::UrlFor, this module accesses the HTTP layer to define +# In addition to AbstractController::UrlFor, this module accesses the HTTP layer to define # url options like the +host+. In order to do so, this module requires the host class -# to implement #env and #request, which need to be a Rack-compatible. +# to implement +env+ and +request+, which need to be a Rack-compatible. # # Example: # # class RootUrl # include ActionController::UrlFor # include Rails.application.routes.url_helpers +# # delegate :env, :request, :to => :controller # # def initialize(controller) # @controller = controller # @url = root_path # named route from the application. # end +# end +# => module ActionController module UrlFor extend ActiveSupport::Concern -- cgit v1.2.3