1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove deprecated formatted named routes

This commit is contained in:
José Valim 2010-01-04 22:10:13 +01:00
parent 79438b4638
commit bd729344a7
2 changed files with 0 additions and 26 deletions

View file

@ -189,14 +189,6 @@ module ActionDispatch
url_for(#{hash_access_method}(opts)) # url_for(hash_for_users_url(opts)) url_for(#{hash_access_method}(opts)) # url_for(hash_for_users_url(opts))
# #
end # end end # end
#Add an alias to support the now deprecated formatted_* URL. # #Add an alias to support the now deprecated formatted_* URL.
def formatted_#{selector}(*args) # def formatted_users_url(*args)
ActiveSupport::Deprecation.warn( # ActiveSupport::Deprecation.warn(
"formatted_#{selector}() has been deprecated. " + # "formatted_users_url() has been deprecated. " +
"Please pass format to the standard " + # "Please pass format to the standard " +
"#{selector} method instead.", caller) # "users_url method instead.", caller)
#{selector}(*args) # users_url(*args)
end # end
protected :#{selector} # protected :users_url protected :#{selector} # protected :users_url
end_eval end_eval
helpers << selector helpers << selector

View file

@ -347,24 +347,6 @@ class UrlWriterTests < ActionController::TestCase
end end
end end
def test_formatted_url_methods_are_deprecated
with_routing do |set|
set.draw do |map|
resources :posts
end
# We need to create a new class in order to install the new named route.
kls = Class.new { include ActionController::UrlWriter }
controller = kls.new
params = {:id => 1, :format => :xml}
assert_deprecated do
assert_equal("/posts/1.xml", controller.send(:formatted_post_path, params))
end
assert_deprecated do
assert_equal("/posts/1.xml", controller.send(:formatted_post_path, 1, :xml))
end
end
end
def test_multiple_includes_maintain_distinct_options def test_multiple_includes_maintain_distinct_options
first_class = Class.new { include ActionController::UrlWriter } first_class = Class.new { include ActionController::UrlWriter }
second_class = Class.new { include ActionController::UrlWriter } second_class = Class.new { include ActionController::UrlWriter }