Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7970

Show
Ignore:
Timestamp:
10/19/07 00:52:55 (2 years ago)
Author:
nzkoz
Message:

Rename image_path path_to_image to avoid conflicting with named routes. Closes #9924 [gbuesing]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_view/helpers/asset_tag_helper.rb

    r7617 r7970  
    327327        compute_public_path(source, 'images') 
    328328      end 
     329      alias_method :path_to_image, :image_path # aliased to avoid conflicts with an image_path named route 
    329330 
    330331      # Returns an html image tag for the +source+. The +source+ can be a full 
     
    357358        options.symbolize_keys! 
    358359 
    359         options[:src] = image_path(source) 
     360        options[:src] = path_to_image(source) 
    360361        options[:alt] ||= File.basename(options[:src], '.*').split('.').first.capitalize 
    361362 
  • trunk/actionpack/lib/action_view/helpers/form_tag_helper.rb

    r7668 r7970  
    362362      #   # => <input class="agree-disagree-button" disabled="disabled" src="/images/agree.png" type="image" /> 
    363363      def image_submit_tag(source, options = {}) 
    364         tag :input, { "type" => "image", "src" => image_path(source) }.update(options.stringify_keys) 
     364        tag :input, { "type" => "image", "src" => path_to_image(source) }.update(options.stringify_keys) 
    365365      end 
    366366 
  • trunk/actionpack/test/template/asset_tag_helper_test.rb

    r7617 r7970  
    159159  end 
    160160   
     161  def test_path_to_image_alias_for_image_path 
     162    ImagePathToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } 
     163  end 
     164 
    161165  def test_image_tag 
    162166    ImageLinkToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) }