aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-09-09 22:41:45 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-09-09 22:41:45 +0000
commitc6c3fc42d8fb971692d5c15406bde299345f879b (patch)
treea1f1923f5c9036e7180f74ae5fb19603ab89febd /actionpack/lib
parent44a178754eed0398e37521b6fa070b78c8d0be27 (diff)
downloadrails-c6c3fc42d8fb971692d5c15406bde299345f879b.tar.gz
rails-c6c3fc42d8fb971692d5c15406bde299345f879b.tar.bz2
rails-c6c3fc42d8fb971692d5c15406bde299345f879b.zip
Removed the deprecated behavior of appending ".png" to image_tag/image_path calls without an existing extension [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7432 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helper.rb26
1 files changed, 10 insertions, 16 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
index 46b08fce76..497bf1aca1 100644
--- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -319,25 +319,17 @@ module ActionView
# a filename without an extension is deprecated.
#
# ==== Examples
- # 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("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
def image_path(source)
- unless (source.split("/").last || source).include?(".") || source.blank?
- ActiveSupport::Deprecation.warn(
- "You've called image_path with a source that doesn't include an extension. " +
- "In Rails 2.0, that will not result in .png automatically being appended. " +
- "So you should call image_path('#{source}.png') instead", caller
- )
- end
-
- compute_public_path(source, 'images', 'png')
+ compute_public_path(source, 'images')
end
# 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. Note that
- # specifying a filename without the extension is now deprecated in Rails.
+ # path or a file that exists in your public images directory.
#
# ==== Options
# You can add HTML attributes using the +options+. The +options+ supports
@@ -350,6 +342,8 @@ module ActionView
# value is not in the correct format.
#
# ==== Examples
+ # image_tag("icon") # =>
+ # <img src="/images/icon" alt="Icon" />
# image_tag("icon.png") # =>
# <img src="/images/icon.png" alt="Icon" />
# image_tag("icon.png", :size => "16x10", :alt => "Edit Entry") # =>
@@ -380,8 +374,8 @@ module ActionView
# roots. Rewrite the asset path for cache-busting asset ids. Include
# a single or wildcarded asset host, if configured, with the correct
# request protocol.
- def compute_public_path(source, dir, ext, include_host = true)
- source += ".#{ext}" if File.extname(source).blank?
+ def compute_public_path(source, dir, ext = nil, include_host = true)
+ source += ".#{ext}" if File.extname(source).blank? && ext
if source =~ %r{^[-a-z]+://}
source