Skip to content

Commit

Permalink
Merge pull request #18325 from rafaelfranca/rm-remove-deprecations
Browse files Browse the repository at this point in the history
Remove all deprecation code
  • Loading branch information
rafaelfranca committed Jan 4, 2015
2 parents c7a1fa3 + bf7b8c1 commit 6d72485
Show file tree
Hide file tree
Showing 92 changed files with 339 additions and 1,433 deletions.
8 changes: 8 additions & 0 deletions actionmailer/CHANGELOG.md
@@ -1,3 +1,11 @@
* Remove deprecate `*_path` helpers in email views.

*Rafael Mendonça França*

* Remove deprecated `deliver` and `deliver!` methods.

*claudiob*

* Template lookup now respects default locale and I18n fallbacks.

Given the following templates:
Expand Down
21 changes: 0 additions & 21 deletions actionmailer/lib/action_mailer/message_delivery.rb
@@ -1,5 +1,4 @@
require 'delegate'
require 'active_support/core_ext/string/filters'

module ActionMailer

Expand Down Expand Up @@ -85,26 +84,6 @@ def deliver_now
message.deliver
end

def deliver! #:nodoc:
ActiveSupport::Deprecation.warn(<<-MSG.squish)
`#deliver!` is deprecated and will be removed in Rails 5. Use
`#deliver_now!` to deliver immediately or `#deliver_later!` to
deliver through Active Job.
MSG

deliver_now!
end

def deliver #:nodoc:
ActiveSupport::Deprecation.warn(<<-MSG.squish)
`#deliver` is deprecated and will be removed in Rails 5. Use
`#deliver_now` to deliver immediately or `#deliver_later` to
deliver through Active Job.
MSG

deliver_now
end

private

def enqueue_delivery(delivery_method, options={})
Expand Down
19 changes: 0 additions & 19 deletions actionmailer/test/message_delivery_test.rb
Expand Up @@ -32,25 +32,6 @@ class MessageDeliveryTest < ActiveSupport::TestCase
assert_equal Mail::Message , @mail.message.class
end

test 'should respond to .deliver' do
assert_respond_to @mail, :deliver
end

test 'should respond to .deliver!' do
assert_respond_to @mail, :deliver!
end

test '.deliver is deprecated' do
assert_deprecated do
@mail.deliver
end
end
test '.deliver! is deprecated' do
assert_deprecated do
@mail.deliver!
end
end

test 'should respond to .deliver_later' do
assert_respond_to @mail, :deliver_later
end
Expand Down
36 changes: 36 additions & 0 deletions actionpack/CHANGELOG.md
@@ -1,3 +1,39 @@
* Remove deprecated assertion files.

*Rafael Mendonça França*

* Remove deprecated usage of string keys in URL helpers.

*Rafael Mendonça França*

* Remove deprecated `only_path` option on `*_path` helpers.

*Rafael Mendonça França*

* Remove deprecated `NamedRouteCollection#helpers`.

*Rafael Mendonça França*

* Remove deprecated support to define routes with `:to` option that doesn't contain `#`.

*Rafael Mendonça França*

* Remove deprecated `ActionDispatch::Response#to_ary`.

*Rafael Mendonça França*

* Remove deprecated `ActionDispatch::Request#deep_munge`.

*Rafael Mendonça França*

* Remove deprecated `ActionDispatch::Http::Parameters#symbolized_path_parameters`.

*Rafael Mendonça França*

* Remove deprecated option `use_route` in controller tests.

*Rafael Mendonça França*

* Ensure `append_info_to_payload` is called even if an exception is raised.

Fixes an issue where when an exception is raised in the request the additonal
Expand Down
24 changes: 1 addition & 23 deletions actionpack/lib/action_controller/test_case.rb
Expand Up @@ -2,7 +2,6 @@
require 'active_support/core_ext/object/to_query'
require 'active_support/core_ext/module/anonymous'
require 'active_support/core_ext/hash/keys'
require 'active_support/deprecation'

require 'rails-dom-testing'

Expand Down Expand Up @@ -714,28 +713,7 @@ def build_request_uri(action, parameters)
:relative_url_root => nil,
:_recall => @request.path_parameters)

if route_name = options.delete(:use_route)
ActiveSupport::Deprecation.warn <<-MSG.squish
Passing the `use_route` option in functional tests are deprecated.
Support for this option in the `process` method (and the related
`get`, `head`, `post`, `patch`, `put` and `delete` helpers) will
be removed in the next version without replacement.
Functional tests are essentially unit tests for controllers and
they should not require knowledge to how the application's routes
are configured. Instead, you should explicitly pass the appropiate
params to the `process` method.
Previously the engines guide also contained an incorrect example
that recommended using this option to test an engine's controllers
within the dummy application. That recommendation was incorrect
and has since been corrected. Instead, you should override the
`@routes` variable in the test case with `Foo::Engine.routes`. See
the updated engines guide for details.
MSG
end

url, query_string = @routes.path_for(options, route_name).split("?", 2)
url, query_string = @routes.path_for(options).split("?", 2)

@request.env["SCRIPT_NAME"] = @controller.config.relative_url_root
@request.env["PATH_INFO"] = url
Expand Down
8 changes: 0 additions & 8 deletions actionpack/lib/action_dispatch/http/parameters.rb
@@ -1,6 +1,5 @@
require 'active_support/core_ext/hash/keys'
require 'active_support/core_ext/hash/indifferent_access'
require 'active_support/deprecation'

module ActionDispatch
module Http
Expand All @@ -25,13 +24,6 @@ def path_parameters=(parameters) #:nodoc:
@env[PARAMETERS_KEY] = parameters
end

def symbolized_path_parameters
ActiveSupport::Deprecation.warn(
'`symbolized_path_parameters` is deprecated. Please use `path_parameters`.'
)
path_parameters
end

# Returns a hash with the \parameters used to form the \path of the request.
# Returned hash keys are strings:
#
Expand Down
9 changes: 0 additions & 9 deletions actionpack/lib/action_dispatch/http/request.rb
Expand Up @@ -337,15 +337,6 @@ def local?
LOCALHOST =~ remote_addr && LOCALHOST =~ remote_ip
end

# Extracted into ActionDispatch::Request::Utils.deep_munge, but kept here for backwards compatibility.
def deep_munge(hash)
ActiveSupport::Deprecation.warn(
'This method has been extracted into `ActionDispatch::Request::Utils.deep_munge`. Please start using that instead.'
)

Utils.deep_munge(hash)
end

protected
def parse_query(qs)
Utils.deep_munge(super)
Expand Down
16 changes: 0 additions & 16 deletions actionpack/lib/action_dispatch/http/response.rb
@@ -1,6 +1,4 @@
require 'active_support/core_ext/module/attribute_accessors'
require 'active_support/core_ext/string/filters'
require 'active_support/deprecation'
require 'action_dispatch/http/filter_redirect'
require 'monitor'

Expand Down Expand Up @@ -284,20 +282,6 @@ def to_a
end
alias prepare! to_a

# Be super clear that a response object is not an Array. Defining this
# would make implicit splatting work, but it also makes adding responses
# as arrays work, and "flattening" responses, cascading to the rack body!
# Not sensible behavior.
def to_ary
ActiveSupport::Deprecation.warn(<<-MSG.squish)
`ActionDispatch::Response#to_ary` no longer performs implicit conversion
to an array. Please use `response.to_a` instead, or a splat like `status,
headers, body = *response`.
MSG

to_a
end

# Returns the response cookies, converted to a Hash of (name => value) pairs
#
# assert_equal 'AuthorOfNewPage', r.cookies['author']
Expand Down
15 changes: 0 additions & 15 deletions actionpack/lib/action_dispatch/journey/formatter.rb
@@ -1,5 +1,4 @@
require 'action_controller/metal/exceptions'
require 'active_support/deprecation'

module ActionDispatch
module Journey
Expand Down Expand Up @@ -81,9 +80,6 @@ def match_route(name, options)
if named_routes.key?(name)
yield named_routes[name]
else
# Make sure we don't show the deprecation warning more than once
warned = false

routes = non_recursive(cache, options)

hash = routes.group_by { |_, r| r.score(options) }
Expand All @@ -92,17 +88,6 @@ def match_route(name, options)
break if score < 0

hash[score].sort_by { |i, _| i }.each do |_, route|
if name && !warned
ActiveSupport::Deprecation.warn <<-MSG.squish
You are trying to generate the URL for a named route called
#{name.inspect} but no such route was found. In the future,
this will result in an `ActionController::UrlGenerationError`
exception.
MSG

warned = true
end

yield route
end
end
Expand Down
20 changes: 2 additions & 18 deletions actionpack/lib/action_dispatch/routing/mapper.rb
Expand Up @@ -4,11 +4,9 @@
require 'active_support/core_ext/enumerable'
require 'active_support/core_ext/array/extract_options'
require 'active_support/core_ext/module/remove_method'
require 'active_support/core_ext/string/filters'
require 'active_support/inflector'
require 'action_dispatch/routing/redirection'
require 'action_dispatch/routing/endpoint'
require 'active_support/deprecation'

module ActionDispatch
module Routing
Expand Down Expand Up @@ -279,22 +277,8 @@ def check_part(name, part, path_params, hash)
end

def split_to(to)
case to
when Symbol
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Defining a route where `to` is a symbol is deprecated.
Please change `to: :#{to}` to `action: :#{to}`.
MSG

[nil, to.to_s]
when /#/ then to.split('#')
when String
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Defining a route where `to` is a controller without an action is deprecated.
Please change `to: :#{to}` to `controller: :#{to}`.
MSG

[to, nil]
if to =~ /#/
to.split('#')
else
[]
end
Expand Down

0 comments on commit 6d72485

Please sign in to comment.