aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/renderer/partial_renderer.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-04-19 10:31:59 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-04-19 10:31:59 -0700
commitfc5090c937db4d3795aa97d9130747ab6a1de8b0 (patch)
treee92a0a73136ca7dbd5efd638abe143a4c39b9c9c /actionpack/lib/action_view/renderer/partial_renderer.rb
parenteaec0ec71f00f76f47811fc2f27761c7a73056b9 (diff)
parente8aceae5dba8ce067972c85e153ba7aeefd69342 (diff)
downloadrails-fc5090c937db4d3795aa97d9130747ab6a1de8b0.tar.gz
rails-fc5090c937db4d3795aa97d9130747ab6a1de8b0.tar.bz2
rails-fc5090c937db4d3795aa97d9130747ab6a1de8b0.zip
Merge pull request #10265 from wangjohn/documenting_actionview
Adding documentation to Renderer
Diffstat (limited to 'actionpack/lib/action_view/renderer/partial_renderer.rb')
-rw-r--r--actionpack/lib/action_view/renderer/partial_renderer.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/renderer/partial_renderer.rb b/actionpack/lib/action_view/renderer/partial_renderer.rb
index 43a88b0623..821026268a 100644
--- a/actionpack/lib/action_view/renderer/partial_renderer.rb
+++ b/actionpack/lib/action_view/renderer/partial_renderer.rb
@@ -313,6 +313,13 @@ module ActionView
private
+ # Sets up instance variables needed for rendering a partial. This method
+ # finds the options and details and extracts them. The method also contains
+ # logic that handles the type of object passed in as the partial.
+ #
+ # If +options[:partial]+ is a string, then the +@path+ instance variable is
+ # set to that string. Otherwise, the +options[:partial]+ object must
+ # respond to +to_partial_path+ in order to setup the path.
def setup(context, options, block)
@view = context
partial = options[:partial]
@@ -413,6 +420,13 @@ module ActionView
end
end
+ # Obtains the path to where the object's partial is located. If the object
+ # responds to +to_partial_path+, then +to_partial_path+ will be called and
+ # will provide the path. If the object does not respond to +to_partial_path+,
+ # then an +ArgumentError+ is raised.
+ #
+ # If +prefix_partial_path_with_controller_namespace+ is true, then this
+ # method will prefix the partial paths with a namespace.
def partial_path(object = @object)
object = object.to_model if object.respond_to?(:to_model)