From 8b2266a8dada979d72ff6eda4349a24be3b630eb Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Fri, 9 Apr 2010 11:09:55 -0700 Subject: image_path -> path_to_image in a couple of places, plus motivation for path_to_image in rdoc --- .../lib/action_view/helpers/asset_tag_helper.rb | 23 ++++++++++++---------- .../lib/action_view/helpers/form_tag_helper.rb | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb index 85401ad561..563d9ec319 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb @@ -515,7 +515,7 @@ module ActionView # # <%= favicon_link_tag 'favicon.ico' %> # - # That's passed to +image_path+ as is, so it gives + # That's passed to +path_to_image+ as is, so it gives # # # @@ -531,20 +531,23 @@ module ActionView tag('link', { :rel => 'shortcut icon', :type => 'image/vnd.microsoft.icon', - :href => image_path(source) + :href => path_to_image(source) }.merge(options.symbolize_keys)) end # Computes the path to an image asset in the public images directory. # Full paths from the document root will be passed through. - # Used internally by +image_tag+ to build the image path. + # Used internally by +image_tag+ to build the image path: # - # ==== Examples - # image_path("edit") # => /images/edit - # image_path("edit.png") # => /images/edit.png - # image_path("icons/edit.png") # => /images/icons/edit.png - # image_path("/icons/edit.png") # => /icons/edit.png - # image_path("http://www.railsapplication.com/img/edit.png") # => http://www.railsapplication.com/img/edit.png + # image_path("edit") # => "/images/edit" + # image_path("edit.png") # => "/images/edit.png" + # image_path("icons/edit.png") # => "/images/icons/edit.png" + # image_path("/icons/edit.png") # => "/icons/edit.png" + # image_path("http://www.railsapplication.com/img/edit.png") # => "http://www.railsapplication.com/img/edit.png" + # + # If you have images as application resources this method may conflict with their named routes. + # The alias +path_to_image+ is provided to avoid that. Rails uses the alias internally, and + # plugin authors are encouraged to do so. def image_path(source) compute_public_path(source, 'images') end @@ -624,7 +627,7 @@ module ActionView end if mouseover = options.delete(:mouseover) - options[:onmouseover] = "this.src='#{image_path(mouseover)}'" + options[:onmouseover] = "this.src='#{path_to_image(mouseover)}'" options[:onmouseout] = "this.src='#{src}'" end diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 388d6813ef..b840f77fb5 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -398,7 +398,7 @@ module ActionView # Displays an image which when clicked will submit the form. # - # source is passed to AssetTagHelper#image_path + # source is passed to AssetTagHelper#path_to_image # # ==== Options # * :confirm => 'question?' - This will add a JavaScript confirm -- cgit v1.2.3