aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-20 15:12:38 +0100
committerJosé Valim <jose.valim@gmail.com>2011-12-20 15:12:38 +0100
commit6c57177f2c7f4f934716d588545902d5fc00fa99 (patch)
treedd5fe4b2e1ab708fdc9aa4324ca382de87da9cf3
parentcae1768c6a0e3d1cd4a2c2d836ef213438689db6 (diff)
downloadrails-6c57177f2c7f4f934716d588545902d5fc00fa99.tar.gz
rails-6c57177f2c7f4f934716d588545902d5fc00fa99.tar.bz2
rails-6c57177f2c7f4f934716d588545902d5fc00fa99.zip
Remove deprecation warnings from Action Pack.
-rw-r--r--actionpack/lib/action_dispatch/middleware/show_exceptions.rb26
-rw-r--r--actionpack/lib/action_dispatch/routing/redirection.rb9
-rw-r--r--actionpack/lib/action_view/helpers/asset_paths.rb7
-rw-r--r--actionpack/lib/action_view/lookup_context.rb12
-rw-r--r--actionpack/lib/action_view/renderer/abstract_renderer.rb12
-rw-r--r--actionpack/lib/action_view/renderer/partial_renderer.rb9
-rw-r--r--actionpack/lib/action_view/renderer/template_renderer.rb1
-rw-r--r--actionpack/test/controller/render_test.rb6
-rw-r--r--actionpack/test/template/render_test.rb32
9 files changed, 6 insertions, 108 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
index 5eceeece1f..3d06214bf1 100644
--- a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
+++ b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
@@ -22,31 +22,7 @@ module ActionDispatch
"application's log file and/or the web server's log file to find out what " <<
"went wrong.</body></html>"]]
- class << self
- def rescue_responses
- ActiveSupport::Deprecation.warn "ActionDispatch::ShowExceptions.rescue_responses is deprecated. " \
- "Please configure your exceptions using a railtie or in your application config instead."
- ExceptionWrapper.rescue_responses
- end
-
- def rescue_templates
- ActiveSupport::Deprecation.warn "ActionDispatch::ShowExceptions.rescue_templates is deprecated. " \
- "Please configure your exceptions using a railtie or in your application config instead."
- ExceptionWrapper.rescue_templates
- end
- end
-
- def initialize(app, exceptions_app = nil)
- if [true, false].include?(exceptions_app)
- ActiveSupport::Deprecation.warn "Passing consider_all_requests_local option to ActionDispatch::ShowExceptions middleware no longer works"
- exceptions_app = nil
- end
-
- if exceptions_app.nil?
- raise ArgumentError, "You need to pass an exceptions_app when initializing ActionDispatch::ShowExceptions. " \
- "In case you want to render pages from a public path, you can use ActionDispatch::PublicExceptions.new('path/to/public')"
- end
-
+ def initialize(app, exceptions_app)
@app = app
@exceptions_app = exceptions_app
end
diff --git a/actionpack/lib/action_dispatch/routing/redirection.rb b/actionpack/lib/action_dispatch/routing/redirection.rb
index 330400e139..617b24b46a 100644
--- a/actionpack/lib/action_dispatch/routing/redirection.rb
+++ b/actionpack/lib/action_dispatch/routing/redirection.rb
@@ -97,16 +97,7 @@ module ActionDispatch
} if String === path
block = path if path.respond_to? :call
-
- # :FIXME: remove in Rails 4.0
- if block && block.respond_to?(:arity) && block.arity < 2
- msg = "redirect blocks with arity of #{block.arity} are deprecated. Your block must take 2 parameters: the environment, and a request object"
- ActiveSupport::Deprecation.warn msg
- block = lambda { |params, _| block.call(params) }
- end
-
raise ArgumentError, "redirection argument not supported" unless block
-
Redirect.new status, block
end
end
diff --git a/actionpack/lib/action_view/helpers/asset_paths.rb b/actionpack/lib/action_view/helpers/asset_paths.rb
deleted file mode 100644
index fae2e4fc1c..0000000000
--- a/actionpack/lib/action_view/helpers/asset_paths.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-ActiveSupport::Deprecation.warn "ActionView::Helpers::AssetPaths is deprecated. Please use ActionView::AssetPaths instead."
-
-module ActionView
- module Helpers
- AssetPaths = ::ActionView::AssetPaths
- end
-end \ No newline at end of file
diff --git a/actionpack/lib/action_view/lookup_context.rb b/actionpack/lib/action_view/lookup_context.rb
index 3bb2b98e48..3f07314dda 100644
--- a/actionpack/lib/action_view/lookup_context.rb
+++ b/actionpack/lib/action_view/lookup_context.rb
@@ -151,14 +151,8 @@ module ActionView
# as well as incorrectly putting part of the path in the template
# name instead of the prefix.
def normalize_name(name, prefixes) #:nodoc:
- name = name.to_s.sub(handlers_regexp) do |match|
- ActiveSupport::Deprecation.warn "Passing a template handler in the template name is deprecated. " \
- "You can simply remove the handler name or pass render :handlers => [:#{match[1..-1]}] instead.", caller
- ""
- end
-
prefixes = nil if prefixes.blank?
- parts = name.split('/')
+ parts = name.to_s.split('/')
name = parts.pop
return name, prefixes || [""] if parts.empty?
@@ -168,10 +162,6 @@ module ActionView
return name, prefixes
end
-
- def handlers_regexp #:nodoc:
- @@handlers_regexp ||= /\.(?:#{default_handlers.join('|')})$/
- end
end
include Accessors
diff --git a/actionpack/lib/action_view/renderer/abstract_renderer.rb b/actionpack/lib/action_view/renderer/abstract_renderer.rb
index c0936441ac..5a611e9f63 100644
--- a/actionpack/lib/action_view/renderer/abstract_renderer.rb
+++ b/actionpack/lib/action_view/renderer/abstract_renderer.rb
@@ -22,18 +22,6 @@ module ActionView
details
end
- def extract_format(value, details)
- if value.is_a?(String) && value.sub!(formats_regexp, "")
- ActiveSupport::Deprecation.warn "Passing the format in the template name is deprecated. " \
- "Please pass render with :formats => [:#{$1}] instead.", caller
- details[:formats] ||= [$1.to_sym]
- end
- end
-
- def formats_regexp
- @@formats_regexp ||= /\.(#{Mime::SET.symbols.join('|')})$/
- end
-
def instrument(name, options={})
ActiveSupport::Notifications.instrument("render_#{name}.action_view", options){ yield }
end
diff --git a/actionpack/lib/action_view/renderer/partial_renderer.rb b/actionpack/lib/action_view/renderer/partial_renderer.rb
index 374bdb62f5..e231aade01 100644
--- a/actionpack/lib/action_view/renderer/partial_renderer.rb
+++ b/actionpack/lib/action_view/renderer/partial_renderer.rb
@@ -300,7 +300,6 @@ module ActionView
"and is followed by any combinations of letters, numbers, or underscores.")
end
- extract_format(@path, @details)
self
end
@@ -369,13 +368,7 @@ module ActionView
path = if object.respond_to?(:to_partial_path)
object.to_partial_path
else
- klass = object.class
- if klass.respond_to?(:model_name)
- ActiveSupport::Deprecation.warn "ActiveModel-compatible objects whose classes return a #model_name that responds to #partial_path are deprecated. Please respond to #to_partial_path directly instead."
- klass.model_name.partial_path
- else
- raise ArgumentError.new("'#{object.inspect}' is not an ActiveModel-compatible object that returns a valid partial path.")
- end
+ raise ArgumentError.new("'#{object.inspect}' is not an ActiveModel-compatible object. It must implement :to_partial_path.")
end
@partial_names[path] ||= merge_prefix_into_object_path(@context_prefix, path.dup)
diff --git a/actionpack/lib/action_view/renderer/template_renderer.rb b/actionpack/lib/action_view/renderer/template_renderer.rb
index e131afa279..3e3a44b432 100644
--- a/actionpack/lib/action_view/renderer/template_renderer.rb
+++ b/actionpack/lib/action_view/renderer/template_renderer.rb
@@ -6,7 +6,6 @@ module ActionView
def render(context, options)
@view = context
@details = extract_details(options)
- extract_format(options[:file] || options[:template], @details)
template = determine_template(options)
freeze_formats(template.formats, true)
render_template(template, options[:layout], options[:locals])
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb
index f42a04d670..768cfb34ac 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -43,7 +43,7 @@ class TestController < ActionController::Base
end
def hello_world_file
- render :file => File.expand_path("../../fixtures/hello.html", __FILE__)
+ render :file => File.expand_path("../../fixtures/hello", __FILE__), :formats => [:html]
end
def conditional_hello
@@ -810,9 +810,7 @@ class RenderTest < ActionController::TestCase
end
def test_render_file
- assert_deprecated do
- get :hello_world_file
- end
+ get :hello_world_file
assert_equal "Hello world!", @response.body
end
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb
index c29519276d..2ba86306f4 100644
--- a/actionpack/test/template/render_test.rb
+++ b/actionpack/test/template/render_test.rb
@@ -146,7 +146,7 @@ module RenderTestCases
@view.render(:partial => nil)
flunk "Render did not raise ArgumentError"
rescue ArgumentError => e
- assert_equal "'#{nil.inspect}' is not an ActiveModel-compatible object that returns a valid partial path.", e.message
+ assert_equal "'#{nil.inspect}' is not an ActiveModel-compatible object. It must implement :to_partial_path.", e.message
end
def test_render_partial_with_errors
@@ -243,36 +243,6 @@ module RenderTestCases
@controller_view.render(customers, :greeting => "Hello")
end
- class CustomerWithDeprecatedPartialPath
- attr_reader :name
-
- def self.model_name
- Struct.new(:partial_path).new("customers/customer")
- end
-
- def initialize(name)
- @name = name
- end
- end
-
- def test_render_partial_using_object_with_deprecated_partial_path
- assert_deprecated(/#model_name.*#partial_path.*#to_partial_path/) do
- assert_equal "Hello: nertzy",
- @controller_view.render(CustomerWithDeprecatedPartialPath.new("nertzy"), :greeting => "Hello")
- end
- end
-
- def test_render_partial_using_collection_with_deprecated_partial_path
- assert_deprecated(/#model_name.*#partial_path.*#to_partial_path/) do
- customers = [
- CustomerWithDeprecatedPartialPath.new("nertzy"),
- CustomerWithDeprecatedPartialPath.new("peeja")
- ]
- assert_equal "Hello: nertzyHello: peeja",
- @controller_view.render(customers, :greeting => "Hello")
- end
- end
-
# TODO: The reason for this test is unclear, improve documentation
def test_render_partial_and_fallback_to_layout
assert_equal "Before (Josh)\n\nAfter", @view.render(:partial => "test/layout_for_partial", :locals => { :name => "Josh" })