diff options
author | José Valim <jose.valim@gmail.com> | 2009-06-23 16:52:39 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-06-23 16:52:39 +0200 |
commit | 0744900861892be85b4a110612a8e92aed94d858 (patch) | |
tree | e879b3cd4d0839baaa0fb50f0927c6671b75ca11 /actionpack/lib | |
parent | 6dd196914c293fbc1a331e4a0bc1c06a26dded43 (diff) | |
parent | 80f1f863cd0f9cba89079511282de5710a2e1832 (diff) | |
download | rails-0744900861892be85b4a110612a8e92aed94d858.tar.gz rails-0744900861892be85b4a110612a8e92aed94d858.tar.bz2 rails-0744900861892be85b4a110612a8e92aed94d858.zip |
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb | 3 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/capture_helper.rb | 22 |
2 files changed, 23 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb b/actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb index d9b614c237..c6f7de17bd 100644 --- a/actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb +++ b/actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb @@ -112,8 +112,7 @@ module ActionController # Returns the path component of a URL for the given record. It uses # <tt>polymorphic_url</tt> with <tt>:routing_type => :path</tt>. def polymorphic_path(record_or_hash_or_array, options = {}) - options[:routing_type] = :path - polymorphic_url(record_or_hash_or_array, options) + polymorphic_url(record_or_hash_or_array, options.merge(:routing_type => :path)) end %w(edit new).each do |action| diff --git a/actionpack/lib/action_view/helpers/capture_helper.rb b/actionpack/lib/action_view/helpers/capture_helper.rb index a8b5a9dbb9..c90acc5ac2 100644 --- a/actionpack/lib/action_view/helpers/capture_helper.rb +++ b/actionpack/lib/action_view/helpers/capture_helper.rb @@ -117,6 +117,28 @@ module ActionView @_content_for[name] end + # content_for? simply checks whether any content has been captured yet using content_for + # Useful to render parts of your layout differently based on what is in your views. + # + # ==== Examples + # + # Perhaps you will use different css in you layout if no content_for :right_column + # + # <%# This is the layout %> + # <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + # <head> + # <title>My Website</title> + # <%= yield :script %> + # </head> + # <body class="<%= content_for?(:right_col) ? 'one-column' : 'two-column' %>"> + # <%= yield %> + # <%= yield :right_col %> + # </body> + # </html> + def content_for?(name) + @_content_for[name].present? + end + # Use an alternate output buffer for the duration of the block. # Defaults to a new empty string. def with_output_buffer(buf = nil) #:nodoc: |