aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-04-09 11:09:55 -0700
committerXavier Noria <fxn@hashref.com>2010-04-09 11:10:26 -0700
commit8b2266a8dada979d72ff6eda4349a24be3b630eb (patch)
tree837cec7cac9e1041ca019fde035c4e4d40f813fb /actionpack/lib
parent38f1d3543e1342f99913a5e578b57a8f633a11af (diff)
downloadrails-8b2266a8dada979d72ff6eda4349a24be3b630eb.tar.gz
rails-8b2266a8dada979d72ff6eda4349a24be3b630eb.tar.bz2
rails-8b2266a8dada979d72ff6eda4349a24be3b630eb.zip
image_path -> path_to_image in a couple of places, plus motivation for path_to_image in rdoc
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helper.rb23
-rw-r--r--actionpack/lib/action_view/helpers/form_tag_helper.rb2
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
#
# <link href="/images/favicon.ico?4649789979" rel="shortcut icon" type="image/vnd.microsoft.icon" />
#
@@ -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.
#
- # <tt>source</tt> is passed to AssetTagHelper#image_path
+ # <tt>source</tt> is passed to AssetTagHelper#path_to_image
#
# ==== Options
# * <tt>:confirm => 'question?'</tt> - This will add a JavaScript confirm