Skip to content

Commit

Permalink
Merge pull request rails#19 from github/delete-formatted-route-helper
Browse files Browse the repository at this point in the history
Delete deprecated formatted_ URL helper
  • Loading branch information
Charlie Somerville committed Oct 2, 2013
2 parents 26fce88 + 050be61 commit c96caaa
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
9 changes: 1 addition & 8 deletions actionpack/lib/action_controller/routing/route_set.rb
Expand Up @@ -192,14 +192,7 @@ def #{selector}(*args) #
url_for(#{hash_access_method}(opts)) # url_for(hash_for_users_url(opts))
#
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
end_eval
helpers << selector
Expand Down
18 changes: 0 additions & 18 deletions actionpack/test/controller/url_rewriter_test.rb
Expand Up @@ -357,24 +357,6 @@ def test_named_routes_with_nil_keys
ActionController::Routing::Routes.load!
end

def test_formatted_url_methods_are_deprecated
ActionController::Routing::Routes.draw do |map|
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
ensure
ActionController::Routing::Routes.load!
end

def test_multiple_includes_maintain_distinct_options
first_class = Class.new { include ActionController::UrlWriter }
second_class = Class.new { include ActionController::UrlWriter }
Expand Down

0 comments on commit c96caaa

Please sign in to comment.