diff options
Diffstat (limited to 'actionview/lib/action_view')
5 files changed, 12 insertions, 14 deletions
diff --git a/actionview/lib/action_view/base.rb b/actionview/lib/action_view/base.rb index 72ca6f7ec6..ad1cb1a4be 100644 --- a/actionview/lib/action_view/base.rb +++ b/actionview/lib/action_view/base.rb @@ -75,7 +75,7 @@ module ActionView #:nodoc: # # Headline: <%= local_assigns[:headline] %> # - # This is useful in cases where you aren't sure if the local variable has been assigned. Alternately, you could also use + # This is useful in cases where you aren't sure if the local variable has been assigned. Alternatively, you could also use # <tt>defined? headline</tt> to first check if the variable has been assigned before using it. # # === Template caching diff --git a/actionview/lib/action_view/helpers/asset_tag_helper.rb b/actionview/lib/action_view/helpers/asset_tag_helper.rb index e506c782d6..fa46a22500 100644 --- a/actionview/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionview/lib/action_view/helpers/asset_tag_helper.rb @@ -136,7 +136,7 @@ module ActionView tag( "link", "rel" => tag_options[:rel] || "alternate", - "type" => tag_options[:type] || Mime::Type.lookup_by_extension(type.to_s).to_s, + "type" => tag_options[:type] || Mime[type].to_s, "title" => tag_options[:title] || type.to_s.upcase, "href" => url_options.is_a?(Hash) ? url_for(url_options.merge(:only_path => false)) : url_options ) diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb index 0e8127e29e..0191064326 100644 --- a/actionview/lib/action_view/helpers/form_tag_helper.rb +++ b/actionview/lib/action_view/helpers/form_tag_helper.rb @@ -20,7 +20,7 @@ module ActionView mattr_accessor :embed_authenticity_token_in_remote_forms self.embed_authenticity_token_in_remote_forms = false - # Starts a form tag that points the action to an url configured with <tt>url_for_options</tt> just like + # Starts a form tag that points the action to a url configured with <tt>url_for_options</tt> just like # ActionController::Base#url_for. The method for the form defaults to POST. # # ==== Options diff --git a/actionview/lib/action_view/helpers/tags/collection_helpers.rb b/actionview/lib/action_view/helpers/tags/collection_helpers.rb index fea4c8d4ec..b87b4281d6 100644 --- a/actionview/lib/action_view/helpers/tags/collection_helpers.rb +++ b/actionview/lib/action_view/helpers/tags/collection_helpers.rb @@ -19,6 +19,8 @@ module ActionView def label(label_html_options={}, &block) html_options = @input_html_options.slice(:index, :namespace).merge(label_html_options) + html_options[:for] ||= @input_html_options[:id] if @input_html_options[:id] + @template_object.label(@object_name, @sanitized_attribute_name, @text, html_options, &block) end end diff --git a/actionview/lib/action_view/routing_url_for.rb b/actionview/lib/action_view/routing_url_for.rb index b4cbc80bd5..45e78d1ad9 100644 --- a/actionview/lib/action_view/routing_url_for.rb +++ b/actionview/lib/action_view/routing_url_for.rb @@ -32,7 +32,7 @@ module ActionView # # ==== Examples # <%= url_for(action: 'index') %> - # # => /blog/ + # # => /blogs/ # # <%= url_for(action: 'find', controller: 'books') %> # # => /books/find @@ -84,21 +84,13 @@ module ActionView when Hash options = options.symbolize_keys unless options.key?(:only_path) - if options[:host].nil? - options[:only_path] = _generate_paths_by_default - else - options[:only_path] = false - end + options[:only_path] = only_path?(options[:host]) end super(options) when ActionController::Parameters unless options.key?(:only_path) - if options[:host].nil? - options[:only_path] = _generate_paths_by_default - else - options[:only_path] = false - end + options[:only_path] = only_path?(options[:host]) end super(options) @@ -147,5 +139,9 @@ module ActionView def _generate_paths_by_default true end + + def only_path?(host) + _generate_paths_by_default unless host + end end end |