aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-10-19 00:52:55 +0000
committerMichael Koziarski <michael@koziarski.com>2007-10-19 00:52:55 +0000
commitb1c3fc22c9496d29685b37f0fb2c2df10bdd927a (patch)
tree92a8eac91641b8bd4048aed22b40a107a1b18d11 /actionpack/lib
parent2fac5d1a8b1ebba367058aaf465f709888c44877 (diff)
downloadrails-b1c3fc22c9496d29685b37f0fb2c2df10bdd927a.tar.gz
rails-b1c3fc22c9496d29685b37f0fb2c2df10bdd927a.tar.bz2
rails-b1c3fc22c9496d29685b37f0fb2c2df10bdd927a.zip
Rename image_path path_to_image to avoid conflicting with named routes. Closes #9924 [gbuesing]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7970 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helper.rb3
-rw-r--r--actionpack/lib/action_view/helpers/form_tag_helper.rb2
2 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
index 83bc33bd3b..13378fb302 100644
--- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -326,6 +326,7 @@ module ActionView
def image_path(source)
compute_public_path(source, 'images')
end
+ alias_method :path_to_image, :image_path # aliased to avoid conflicts with an image_path named route
# Returns an html image tag for the +source+. The +source+ can be a full
# path or a file that exists in your public images directory.
@@ -356,7 +357,7 @@ module ActionView
def image_tag(source, options = {})
options.symbolize_keys!
- options[:src] = image_path(source)
+ options[:src] = path_to_image(source)
options[:alt] ||= File.basename(options[:src], '.*').split('.').first.capitalize
if options[:size]
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb
index fdc0d10c6c..ab97fab250 100644
--- a/actionpack/lib/action_view/helpers/form_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -361,7 +361,7 @@ module ActionView
# image_submit_tag("agree.png"), :disabled => true, :class => "agree-disagree-button"
# # => <input class="agree-disagree-button" disabled="disabled" src="/images/agree.png" type="image" />
def image_submit_tag(source, options = {})
- tag :input, { "type" => "image", "src" => image_path(source) }.update(options.stringify_keys)
+ tag :input, { "type" => "image", "src" => path_to_image(source) }.update(options.stringify_keys)
end
# Creates a field set for grouping HTML form elements.