From bc50cb31d6b1064463b371cf428e7eb6fcbf2fd3 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sat, 14 Jan 2012 18:11:38 -0200 Subject: Remove old compatibility methods not being used --- actionpack/lib/action_controller/base.rb | 4 ++-- actionpack/lib/action_controller/metal/compatibility.rb | 4 ---- actionpack/test/controller/caching_test.rb | 2 -- actionpack/test/controller/view_paths_test.rb | 7 ------- 4 files changed, 2 insertions(+), 15 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index b6d441d544..f570a7565c 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -116,7 +116,7 @@ module ActionController # # Title: <%= @post.title %> # - # You don't have to rely on the automated rendering. For example, actions that could result in the rendering of different templates + # You don't have to rely on the automated rendering. For example, actions that could result in the rendering of different templates # will use the manual rendering methods: # # def search @@ -133,7 +133,7 @@ module ActionController # == Redirects # # Redirects are used to move from one action to another. For example, after a create action, which stores a blog entry to the - # database, we might like to show the user the new entry. Because we're following good DRY principles (Don't Repeat Yourself), we're + # database, we might like to show the user the new entry. Because we're following good DRY principles (Don't Repeat Yourself), we're # going to reuse (and redirect to) a show action that we'll assume has already been created. The code might look like this: # # def create diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index 43719d5808..a2d06bab95 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -28,10 +28,6 @@ module ActionController end end - # For old tests - def initialize_template_class(*) end - def assign_shortcuts(*) end - def _normalize_options(options) options[:text] = nil if options.delete(:nothing) == true options[:text] = " " if options.key?(:text) && options[:text].nil? diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index 34a38a5567..443b56830a 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -686,8 +686,6 @@ class FragmentCachingTest < ActionController::TestCase @controller.params = @params @controller.request = @request @controller.response = @response - @controller.send(:initialize_template_class, @response) - @controller.send(:assign_shortcuts, @request, @response) end def test_fragment_cache_key diff --git a/actionpack/test/controller/view_paths_test.rb b/actionpack/test/controller/view_paths_test.rb index 872f171c42..77b928d368 100644 --- a/actionpack/test/controller/view_paths_test.rb +++ b/actionpack/test/controller/view_paths_test.rb @@ -24,16 +24,9 @@ class ViewLoadPathsTest < ActionController::TestCase end def setup - # TestController.view_paths = nil - @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @controller = TestController.new - # Following is needed in order to setup @controller.template object properly - @controller.send :assign_shortcuts, @request, @response - @controller.send :initialize_template_class, @response - @paths = TestController.view_paths end -- cgit v1.2.3 From 6f8b1e3a8555405917e30ab8809124c247132b27 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sat, 14 Jan 2012 18:18:29 -0200 Subject: Remove constant already defined in exceptions module --- actionpack/lib/action_controller/metal/compatibility.rb | 3 --- 1 file changed, 3 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index a2d06bab95..74e24c9321 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -2,9 +2,6 @@ module ActionController module Compatibility extend ActiveSupport::Concern - class ::ActionController::ActionControllerError < StandardError #:nodoc: - end - # Temporary hax included do ::ActionController::UnknownAction = ::AbstractController::ActionNotFound -- cgit v1.2.3 From 1ae9e60b8a369f004d001e885ca71cb0ade2be80 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sat, 14 Jan 2012 18:25:11 -0200 Subject: Remove other old compatibility constants --- actionpack/lib/action_controller/metal/compatibility.rb | 3 --- actionpack/lib/action_controller/metal/exceptions.rb | 2 +- actionpack/test/controller/base_test.rb | 4 ++-- actionpack/test/controller/render_test.rb | 12 ++++++------ actionpack/test/dispatch/debug_exceptions_test.rb | 4 ++-- actionpack/test/dispatch/show_exceptions_test.rb | 2 +- 6 files changed, 12 insertions(+), 15 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index 74e24c9321..6e8b12d379 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -4,9 +4,6 @@ module ActionController # Temporary hax included do - ::ActionController::UnknownAction = ::AbstractController::ActionNotFound - ::ActionController::DoubleRenderError = ::AbstractController::DoubleRenderError - # ROUTES TODO: This should be handled by a middleware and route generation # should be able to handle SCRIPT_NAME self.config.relative_url_root = ENV['RAILS_RELATIVE_URL_ROOT'] diff --git a/actionpack/lib/action_controller/metal/exceptions.rb b/actionpack/lib/action_controller/metal/exceptions.rb index 07024d0a9a..ece9ba3725 100644 --- a/actionpack/lib/action_controller/metal/exceptions.rb +++ b/actionpack/lib/action_controller/metal/exceptions.rb @@ -43,4 +43,4 @@ module ActionController class UnknownHttpMethod < ActionControllerError #:nodoc: end -end \ No newline at end of file +end diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb index c5c48bc559..bda80d1c20 100644 --- a/actionpack/test/controller/base_test.rb +++ b/actionpack/test/controller/base_test.rb @@ -183,8 +183,8 @@ class PerformActionTest < ActionController::TestCase def test_get_on_hidden_should_fail use_controller NonEmptyController - assert_raise(ActionController::UnknownAction) { get :hidden_action } - assert_raise(ActionController::UnknownAction) { get :another_hidden_action } + assert_raise(AbstractController::ActionNotFound) { get :hidden_action } + assert_raise(AbstractController::ActionNotFound) { get :another_hidden_action } end end diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index ec26315dc7..bf04697b6a 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -54,7 +54,7 @@ class TestController < ActionController::Base def conditional_hello_with_record record = Struct.new(:updated_at, :cache_key).new(Time.now.utc.beginning_of_day, "foo/123") - + if stale?(record) render :action => 'hello_world' end @@ -891,12 +891,12 @@ class RenderTest < ActionController::TestCase # :ported: def test_attempt_to_access_object_method - assert_raise(ActionController::UnknownAction, "No action responded to [clone]") { get :clone } + assert_raise(AbstractController::ActionNotFound, "No action responded to [clone]") { get :clone } end # :ported: def test_private_methods - assert_raise(ActionController::UnknownAction, "No action responded to [determine_layout]") { get :determine_layout } + assert_raise(AbstractController::ActionNotFound, "No action responded to [determine_layout]") { get :determine_layout } end # :ported: @@ -1096,15 +1096,15 @@ class RenderTest < ActionController::TestCase # :ported: def test_double_render - assert_raise(ActionController::DoubleRenderError) { get :double_render } + assert_raise(AbstractController::DoubleRenderError) { get :double_render } end def test_double_redirect - assert_raise(ActionController::DoubleRenderError) { get :double_redirect } + assert_raise(AbstractController::DoubleRenderError) { get :double_redirect } end def test_render_and_redirect - assert_raise(ActionController::DoubleRenderError) { get :render_and_redirect } + assert_raise(AbstractController::DoubleRenderError) { get :render_and_redirect } end # specify the one exception to double render rule - render_to_string followed by render diff --git a/actionpack/test/dispatch/debug_exceptions_test.rb b/actionpack/test/dispatch/debug_exceptions_test.rb index f3dc160d7d..c3a565990e 100644 --- a/actionpack/test/dispatch/debug_exceptions_test.rb +++ b/actionpack/test/dispatch/debug_exceptions_test.rb @@ -24,7 +24,7 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest when "/pass" [404, { "X-Cascade" => "pass" }, self] when "/not_found" - raise ActionController::UnknownAction + raise AbstractController::ActionNotFound when "/runtime_error" raise RuntimeError when "/method_not_allowed" @@ -83,7 +83,7 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest get "/not_found", {}, {'action_dispatch.show_exceptions' => true} assert_response 404 - assert_match(/#{ActionController::UnknownAction.name}/, body) + assert_match(/#{AbstractController::ActionNotFound.name}/, body) get "/method_not_allowed", {}, {'action_dispatch.show_exceptions' => true} assert_response 405 diff --git a/actionpack/test/dispatch/show_exceptions_test.rb b/actionpack/test/dispatch/show_exceptions_test.rb index e9504f3524..4a6d5ddbf7 100644 --- a/actionpack/test/dispatch/show_exceptions_test.rb +++ b/actionpack/test/dispatch/show_exceptions_test.rb @@ -7,7 +7,7 @@ class ShowExceptionsTest < ActionDispatch::IntegrationTest req = ActionDispatch::Request.new(env) case req.path when "/not_found" - raise ActionController::UnknownAction + raise AbstractController::ActionNotFound when "/method_not_allowed" raise ActionController::MethodNotAllowed when "/not_found_original_exception" -- cgit v1.2.3 From 71566c357308da8ab3fa86794ef57b853f99ce63 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sat, 14 Jan 2012 18:28:09 -0200 Subject: Remove rescue_action from compatibility module and tests --- actionpack/lib/action_controller/metal/compatibility.rb | 4 ---- actionpack/test/activerecord/active_record_store_test.rb | 10 ++++------ actionpack/test/controller/assert_select_test.rb | 4 ---- actionpack/test/controller/caching_test.rb | 4 ---- actionpack/test/controller/capture_test.rb | 2 -- actionpack/test/controller/content_type_test.rb | 2 -- actionpack/test/controller/filters_test.rb | 12 ------------ actionpack/test/controller/flash_test.rb | 4 ---- actionpack/test/controller/helper_test.rb | 7 ------- actionpack/test/controller/mime_responds_test.rb | 6 +----- actionpack/test/controller/redirect_test.rb | 2 -- actionpack/test/controller/render_test.rb | 4 ---- .../test/controller/request_forgery_protection_test.rb | 2 -- actionpack/test/controller/resources_test.rb | 1 - actionpack/test/controller/routing_test.rb | 1 - actionpack/test/controller/test_case_test.rb | 3 --- actionpack/test/controller/view_paths_test.rb | 1 - actionpack/test/controller/webservice_test.rb | 2 -- actionpack/test/dispatch/session/cache_store_test.rb | 2 -- actionpack/test/dispatch/session/cookie_store_test.rb | 2 -- actionpack/test/dispatch/session/mem_cache_store_test.rb | 2 -- actionpack/test/template/atom_feed_helper_test.rb | 7 +------ actionpack/test/template/url_helper_test.rb | 10 +--------- 23 files changed, 7 insertions(+), 87 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index 6e8b12d379..45e9df6563 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -16,10 +16,6 @@ module ActionController :@_status, :@_headers, :@_params, :@_env, :@_response, :@_request, :@_view_runtime, :@_stream, :@_url_options, :@_action_has_layout ] - - def rescue_action(env) - raise env["action_dispatch.rescue.exception"] - end end def _normalize_options(options) diff --git a/actionpack/test/activerecord/active_record_store_test.rb b/actionpack/test/activerecord/active_record_store_test.rb index 768ac713ca..2fe7959f5a 100644 --- a/actionpack/test/activerecord/active_record_store_test.rb +++ b/actionpack/test/activerecord/active_record_store_test.rb @@ -33,8 +33,6 @@ class ActiveRecordStoreTest < ActionDispatch::IntegrationTest session[:foo] = "baz" head :ok end - - def rescue_action(e) raise end end def setup @@ -225,16 +223,16 @@ class ActiveRecordStoreTest < ActionDispatch::IntegrationTest assert_equal session_id, cookies['_session_id'] end end - + def test_incoming_invalid_session_id_via_cookie_should_be_ignored with_test_route_set do open_session do |sess| sess.cookies['_session_id'] = 'INVALID' - + sess.get '/set_session_value' new_session_id = sess.cookies['_session_id'] assert_not_equal 'INVALID', new_session_id - + sess.get '/get_session_value' new_session_id_2 = sess.cookies['_session_id'] assert_equal new_session_id, new_session_id_2 @@ -248,7 +246,7 @@ class ActiveRecordStoreTest < ActionDispatch::IntegrationTest sess.get '/set_session_value', :_session_id => 'INVALID' new_session_id = sess.cookies['_session_id'] assert_not_equal 'INVALID', new_session_id - + sess.get '/get_session_value' new_session_id_2 = sess.cookies['_session_id'] assert_equal new_session_id, new_session_id_2 diff --git a/actionpack/test/controller/assert_select_test.rb b/actionpack/test/controller/assert_select_test.rb index 5eef8a32d7..d3359e79a6 100644 --- a/actionpack/test/controller/assert_select_test.rb +++ b/actionpack/test/controller/assert_select_test.rb @@ -47,10 +47,6 @@ class AssertSelectTest < ActionController::TestCase render :text=>@content, :layout=>false, :content_type=>Mime::XML @content = nil end - - def rescue_action(e) - raise e - end end tests AssertSelectController diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index 443b56830a..bb4fb7bf07 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -793,10 +793,6 @@ class FunctionalCachingController < CachingController format.xml end end - - def rescue_action(e) - raise e - end end class FunctionalFragmentCachingTest < ActionController::TestCase diff --git a/actionpack/test/controller/capture_test.rb b/actionpack/test/controller/capture_test.rb index a217510434..72263156d9 100644 --- a/actionpack/test/controller/capture_test.rb +++ b/actionpack/test/controller/capture_test.rb @@ -28,8 +28,6 @@ class CaptureController < ActionController::Base def proper_block_detection @todo = "some todo" end - - def rescue_action(e) raise end end class CaptureTest < ActionController::TestCase diff --git a/actionpack/test/controller/content_type_test.rb b/actionpack/test/controller/content_type_test.rb index a312b7c32a..b57f3f1bb5 100644 --- a/actionpack/test/controller/content_type_test.rb +++ b/actionpack/test/controller/content_type_test.rb @@ -48,8 +48,6 @@ class OldContentTypeController < ActionController::Base format.rss { render :text => "hello world!", :content_type => Mime::XML } end end - - def rescue_action(e) raise end end class ContentTypeTest < ActionController::TestCase diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index 9ad0dc75f5..c64628890e 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -165,8 +165,6 @@ class FilterTest < ActionController::TestCase @ran_filter ||= [] @ran_filter << "clean_up_tmp" end - - def rescue_action(e) raise(e) end end class ConditionalCollectionFilterController < ConditionalFilterController @@ -454,11 +452,6 @@ class FilterTest < ActionController::TestCase def show raise ErrorToRescue.new("Something made the bad noise.") end - - private - def rescue_action(exception) - raise exception - end end class NonYieldingAroundFilterController < ActionController::Base @@ -472,9 +465,6 @@ class FilterTest < ActionController::TestCase render :inline => "index" end - #make sure the controller complains - def rescue_action(e); raise e; end - private def filter_one @@ -828,8 +818,6 @@ end class PostsController < ActionController::Base - def rescue_action(e); raise e; end - module AroundExceptions class Error < StandardError ; end class Before < Error ; end diff --git a/actionpack/test/controller/flash_test.rb b/actionpack/test/controller/flash_test.rb index d497913dc4..37ccc7a4a5 100644 --- a/actionpack/test/controller/flash_test.rb +++ b/actionpack/test/controller/flash_test.rb @@ -51,10 +51,6 @@ class FlashTest < ActionController::TestCase render :inline => "hello" end - def rescue_action(e) - raise unless ActionView::MissingTemplate === e - end - # methods for test_sweep_after_halted_filter_chain before_filter :halt_and_redir, :only => "filter_halting_action" diff --git a/actionpack/test/controller/helper_test.rb b/actionpack/test/controller/helper_test.rb index 35a87c1aae..757661d8d0 100644 --- a/actionpack/test/controller/helper_test.rb +++ b/actionpack/test/controller/helper_test.rb @@ -7,16 +7,12 @@ module Fun def render_hello_world render :inline => "hello: <%= stratego %>" end - - def rescue_action(e) raise end end class PdfController < ActionController::Base def test render :inline => "test: <%= foobar %>" end - - def rescue_action(e) raise end end end @@ -60,7 +56,6 @@ class HelperTest < ActiveSupport::TestCase class TestController < ActionController::Base attr_accessor :delegate_attr def delegate_method() end - def rescue_action(e) raise end end def setup @@ -201,8 +196,6 @@ class IsolatedHelpersTest < ActiveSupport::TestCase def index render :inline => '<%= shout %>' end - - def rescue_action(e) raise end end class B < A diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index 76a8c89e60..60498822ff 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -151,10 +151,6 @@ class RespondToController < ActionController::Base end end - def rescue_action(e) - raise - end - protected def set_layout if action_name.in?(["all_types_with_layout", "iphone_with_html_response_type"]) @@ -498,7 +494,7 @@ class RespondToControllerTest < ActionController::TestCase assert_equal '
Hello iPhone future from iPhone!
', @response.body assert_equal "text/html", @response.content_type end - + def test_invalid_format get :using_defaults, :format => "invalidformat" assert_equal " ", @response.body diff --git a/actionpack/test/controller/redirect_test.rb b/actionpack/test/controller/redirect_test.rb index 5b739e49ac..b1d76150f8 100644 --- a/actionpack/test/controller/redirect_test.rb +++ b/actionpack/test/controller/redirect_test.rb @@ -105,8 +105,6 @@ class RedirectController < ActionController::Base def rescue_errors(e) raise e end - def rescue_action(e) raise end - protected def dashbord_url(id, message) url_for :action => "dashboard", :params => { "id" => id, "message" => message } diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index bf04697b6a..8c2d622304 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -649,10 +649,6 @@ class TestController < ActionController::Base render :action => "calling_partial_with_layout", :layout => "layouts/partial_with_layout" end - def rescue_action(e) - raise - end - before_filter :only => :render_with_filters do request.format = :xml end diff --git a/actionpack/test/controller/request_forgery_protection_test.rb b/actionpack/test/controller/request_forgery_protection_test.rb index fd5a41a0bb..4a291582d8 100644 --- a/actionpack/test/controller/request_forgery_protection_test.rb +++ b/actionpack/test/controller/request_forgery_protection_test.rb @@ -36,8 +36,6 @@ module RequestForgeryProtectionActions def form_for_without_protection render :inline => "<%= form_for(:some_resource, :authenticity_token => false ) {} %>" end - - def rescue_action(e) raise e end end # sample controllers diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb index 6b8a8f6161..73d72fe4d6 100644 --- a/actionpack/test/controller/resources_test.rb +++ b/actionpack/test/controller/resources_test.rb @@ -6,7 +6,6 @@ require 'active_support/core_ext/object/inclusion' class ResourcesController < ActionController::Base def index() render :nothing => true end alias_method :show, :index - def rescue_action(e) raise e end end class ThreadsController < ResourcesController; end diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index bf33b8cdd7..bec9eb16f3 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -6,7 +6,6 @@ require 'active_support/core_ext/object/with_options' class MilestonesController < ActionController::Base def index() head :ok end alias_method :show, :index - def rescue_action(e) raise e end end ROUTING = ActionDispatch::Routing diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb index 34b06df8d8..d21cc24e85 100644 --- a/actionpack/test/controller/test_case_test.rb +++ b/actionpack/test/controller/test_case_test.rb @@ -124,9 +124,6 @@ XML end private - def rescue_action(e) - raise e - end def generate_url(opts) url_for(opts.merge(:action => "test_uri")) diff --git a/actionpack/test/controller/view_paths_test.rb b/actionpack/test/controller/view_paths_test.rb index 77b928d368..40f6dc6f0f 100644 --- a/actionpack/test/controller/view_paths_test.rb +++ b/actionpack/test/controller/view_paths_test.rb @@ -3,7 +3,6 @@ require 'abstract_unit' class ViewLoadPathsTest < ActionController::TestCase class TestController < ActionController::Base def self.controller_path() "test" end - def rescue_action(e) raise end before_filter :add_view_path, :only => :hello_world_at_request_time diff --git a/actionpack/test/controller/webservice_test.rb b/actionpack/test/controller/webservice_test.rb index ae8588cbb0..351e61eeae 100644 --- a/actionpack/test/controller/webservice_test.rb +++ b/actionpack/test/controller/webservice_test.rb @@ -18,8 +18,6 @@ class WebServiceTest < ActionDispatch::IntegrationTest s << "#{k}#{value}" end end - - def rescue_action(e) raise end end def setup diff --git a/actionpack/test/dispatch/session/cache_store_test.rb b/actionpack/test/dispatch/session/cache_store_test.rb index 73e056de23..12405bf45d 100644 --- a/actionpack/test/dispatch/session/cache_store_test.rb +++ b/actionpack/test/dispatch/session/cache_store_test.rb @@ -30,8 +30,6 @@ class CacheStoreTest < ActionDispatch::IntegrationTest session[:bar] = "baz" head :ok end - - def rescue_action(e) raise end end def test_setting_and_getting_session_value diff --git a/actionpack/test/dispatch/session/cookie_store_test.rb b/actionpack/test/dispatch/session/cookie_store_test.rb index 92df6967d6..19969394cd 100644 --- a/actionpack/test/dispatch/session/cookie_store_test.rb +++ b/actionpack/test/dispatch/session/cookie_store_test.rb @@ -54,8 +54,6 @@ class CookieStoreTest < ActionDispatch::IntegrationTest request.session_options[:renew] = true head :ok end - - def rescue_action(e) raise end end def test_setting_session_value diff --git a/actionpack/test/dispatch/session/mem_cache_store_test.rb b/actionpack/test/dispatch/session/mem_cache_store_test.rb index 8502bc547b..5277c92b55 100644 --- a/actionpack/test/dispatch/session/mem_cache_store_test.rb +++ b/actionpack/test/dispatch/session/mem_cache_store_test.rb @@ -31,8 +31,6 @@ class MemCacheStoreTest < ActionDispatch::IntegrationTest session[:bar] = "baz" head :ok end - - def rescue_action(e) raise end end begin diff --git a/actionpack/test/template/atom_feed_helper_test.rb b/actionpack/test/template/atom_feed_helper_test.rb index 81d7444cf8..d26aa9aa85 100644 --- a/actionpack/test/template/atom_feed_helper_test.rb +++ b/actionpack/test/template/atom_feed_helper_test.rb @@ -16,7 +16,7 @@ class ScrollsController < ActionController::Base feed.title("My great blog!") feed.updated((@scrolls.first.created_at)) - @scrolls.each do |scroll| + @scrolls.each do |scroll| feed.entry(scroll) do |entry| entry.title(scroll.title) entry.content(scroll.body, :type => 'html') @@ -185,11 +185,6 @@ class ScrollsController < ActionController::Base render :inline => FEEDS[params[:id]], :type => :builder end - - protected - def rescue_action(e) - raise(e) - end end class AtomFeedTest < ActionController::TestCase diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index bc45fabf34..d013a44e6c 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -91,7 +91,7 @@ class UrlHelperTest < ActiveSupport::TestCase def test_button_to_with_remote_and_form_options assert_dom_equal "
", button_to("Hello", "http://www.example.com", :remote => true, :form => { :class => "custom-class", "data-type" => "json" } ) end - + def test_button_to_with_remote_and_javascript_confirm assert_dom_equal( "
", @@ -506,8 +506,6 @@ class UrlHelperControllerTest < ActionController::TestCase render :inline => '<%= url_for(:action => :show_url_for) %>' end - def rescue_action(e) raise e end - def override_url_helper render :inline => '<%= override_url_helper_path %>' end @@ -595,8 +593,6 @@ class TasksController < ActionController::Base render_default end - def rescue_action(e) raise e end - protected def render_default render :inline => @@ -655,8 +651,6 @@ class WorkshopsController < ActionController::Base @workshop = Workshop.new(params[:id]) render :inline => "<%= url_for(@workshop) %>\n<%= link_to('Workshop', @workshop) %>" end - - def rescue_action(e) raise e end end class SessionsController < ActionController::Base @@ -677,8 +671,6 @@ class SessionsController < ActionController::Base @session = Session.new(params[:id]) render :inline => "<%= url_for([@workshop, @session]) %>\n<%= link_to('Session', [@workshop, @session]) %>" end - - def rescue_action(e) raise e end end class PolymorphicControllerTest < ActionController::TestCase -- cgit v1.2.3 From 497004858de24e21dc67f8a9bd3a30b8ce951b92 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sun, 15 Jan 2012 09:48:17 -0200 Subject: Remove relative url root setting from ENV var This is already being set by Rails configuration. --- actionpack/lib/action_controller/metal/compatibility.rb | 4 ---- 1 file changed, 4 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index 45e9df6563..1c205d7c02 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -4,10 +4,6 @@ module ActionController # Temporary hax included do - # ROUTES TODO: This should be handled by a middleware and route generation - # should be able to handle SCRIPT_NAME - self.config.relative_url_root = ENV['RAILS_RELATIVE_URL_ROOT'] - class << self delegate :default_charset=, :to => "ActionDispatch::Response" end -- cgit v1.2.3 From bb33e88833575184b3bd2d0877ea92e170672cde Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sun, 15 Jan 2012 13:45:31 -0200 Subject: Remove deprecated logic to render templates starting with / render :template => "/foo/bar" --- .../lib/action_controller/metal/compatibility.rb | 1 - .../controller/new_base/render_template_test.rb | 22 ---------------------- 2 files changed, 23 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index 1c205d7c02..a9e46f9343 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -21,7 +21,6 @@ module ActionController end def render_to_body(options) - options[:template].sub!(/^\//, '') if options.key?(:template) super || " " end diff --git a/actionpack/test/controller/new_base/render_template_test.rb b/actionpack/test/controller/new_base/render_template_test.rb index ade204c387..88f8cc0d6e 100644 --- a/actionpack/test/controller/new_base/render_template_test.rb +++ b/actionpack/test/controller/new_base/render_template_test.rb @@ -201,26 +201,4 @@ module RenderTemplate assert_status 200 end end - - module Compatibility - class WithoutLayoutController < ActionController::Base - self.view_paths = [ActionView::FixtureResolver.new( - "test/basic.html.erb" => "Hello from basic.html.erb", - "shared.html.erb" => "Elastica" - )] - - def with_forward_slash - render :template => "/test/basic" - end - end - - class TestTemplateRenderWithForwardSlash < Rack::TestCase - test "rendering a normal template with full path starting with a leading slash" do - get "/render_template/compatibility/without_layout/with_forward_slash" - - assert_body "Hello from basic.html.erb" - assert_status 200 - end - end - end end -- cgit v1.2.3 From 562a12df29b573406b15e9824a8288ad8ee6da83 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sun, 15 Jan 2012 15:04:55 -0200 Subject: Rename test class and fix tests to keep consistency Based on 50d23bc2bd3653b3c66e480c22ae97c5f7fd7f62. --- actionpack/test/controller/test_case_test.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'actionpack') diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb index d21cc24e85..caf76c7e61 100644 --- a/actionpack/test/controller/test_case_test.rb +++ b/actionpack/test/controller/test_case_test.rb @@ -2,7 +2,7 @@ require 'abstract_unit' require 'controller/fake_controllers' require 'active_support/ordered_hash' -class TestTest < ActionController::TestCase +class TestCaseTest < ActionController::TestCase class TestController < ActionController::Base def no_op render :text => 'dummy' @@ -171,7 +171,7 @@ XML def test_document_body_and_params_with_post post :test_params, :id => 1 - assert_equal("{\"id\"=>\"1\", \"controller\"=>\"test_test/test\", \"action\"=>\"test_params\"}", @response.body) + assert_equal("{\"id\"=>\"1\", \"controller\"=>\"test_case_test/test\", \"action\"=>\"test_params\"}", @response.body) end def test_document_body_with_post @@ -244,18 +244,18 @@ XML def test_process_with_request_uri_with_no_params process :test_uri - assert_equal "/test_test/test/test_uri", @response.body + assert_equal "/test_case_test/test/test_uri", @response.body end def test_process_with_request_uri_with_params process :test_uri, "GET", :id => 7 - assert_equal "/test_test/test/test_uri/7", @response.body + assert_equal "/test_case_test/test/test_uri/7", @response.body end def test_process_with_old_api assert_deprecated do process :test_uri, :id => 7 - assert_equal "/test_test/test/test_uri/7", @response.body + assert_equal "/test_case_test/test/test_uri/7", @response.body end end @@ -539,7 +539,7 @@ XML get :test_params, :page => {:name => "Page name", :month => '4', :year => '2004', :day => '6'} parsed_params = eval(@response.body) assert_equal( - {'controller' => 'test_test/test', 'action' => 'test_params', + {'controller' => 'test_case_test/test', 'action' => 'test_params', 'page' => {'name' => "Page name", 'month' => '4', 'year' => '2004', 'day' => '6'}}, parsed_params ) @@ -549,7 +549,7 @@ XML get :test_params, :page => {:name => "Page name", :month => 4, :year => 2004, :day => 6} parsed_params = eval(@response.body) assert_equal( - {'controller' => 'test_test/test', 'action' => 'test_params', + {'controller' => 'test_case_test/test', 'action' => 'test_params', 'page' => {'name' => "Page name", 'month' => '4', 'year' => '2004', 'day' => '6'}}, parsed_params ) @@ -561,7 +561,7 @@ XML end parsed_params = eval(@response.body) assert_equal( - {'controller' => 'test_test/test', 'action' => 'test_params', + {'controller' => 'test_case_test/test', 'action' => 'test_params', 'frozen' => 'icy', 'frozens' => ['icy']}, parsed_params ) @@ -581,7 +581,7 @@ XML def test_array_path_parameter_handled_properly with_routing do |set| set.draw do - match 'file/*path', :to => 'test_test/test#test_params' + match 'file/*path', :to => 'test_case_test/test#test_params' match ':controller/:action' end @@ -716,7 +716,7 @@ XML end def test_fixture_path_is_accessed_from_self_instead_of_active_support_test_case - TestTest.stubs(:fixture_path).returns(FILES_DIR) + TestCaseTest.stubs(:fixture_path).returns(FILES_DIR) uploaded_file = fixture_file_upload('/mona_lisa.jpg', 'image/png') assert_equal File.open("#{FILES_DIR}/mona_lisa.jpg", READ_PLAIN).read, uploaded_file.read -- cgit v1.2.3 From 6244d16eaf8eea9ce963f08dced60399b121a6dc Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sun, 15 Jan 2012 15:34:50 -0200 Subject: Move render :nothing and :text => nil options to AC::Rendering --- actionpack/lib/abstract_controller/rendering.rb | 3 +++ actionpack/lib/action_controller/metal/compatibility.rb | 10 ---------- 2 files changed, 3 insertions(+), 10 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb index ddc93464cd..bca0dcffd8 100644 --- a/actionpack/lib/abstract_controller/rendering.rb +++ b/actionpack/lib/abstract_controller/rendering.rb @@ -165,6 +165,9 @@ module AbstractController options[:prefixes] ||= _prefixes end + options[:text] = nil if options.delete(:nothing) == true + options[:text] = " " if options.key?(:text) && options[:text].nil? + options[:template] ||= (options[:action] || action_name).to_s options end diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index a9e46f9343..835d1f7e35 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -14,12 +14,6 @@ module ActionController ] end - def _normalize_options(options) - options[:text] = nil if options.delete(:nothing) == true - options[:text] = " " if options.key?(:text) && options[:text].nil? - super - end - def render_to_body(options) super || " " end @@ -31,9 +25,5 @@ module ActionController def method_for_action(action_name) super || (respond_to?(:method_missing) && "_handle_method_missing") end - - def performed? - response_body - end end end -- cgit v1.2.3 From 53596d091390bda7fb9b78ad838273a9e63fbde1 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sun, 15 Jan 2012 15:37:27 -0200 Subject: Refactor render nothing/text => nil logic, and move to right place Options :nothing and :text => nil should be handled by ActionController::Rendering instead. --- actionpack/lib/abstract_controller/rendering.rb | 3 --- actionpack/lib/action_controller/metal/rendering.rb | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb index bca0dcffd8..ddc93464cd 100644 --- a/actionpack/lib/abstract_controller/rendering.rb +++ b/actionpack/lib/abstract_controller/rendering.rb @@ -165,9 +165,6 @@ module AbstractController options[:prefixes] ||= _prefixes end - options[:text] = nil if options.delete(:nothing) == true - options[:text] = " " if options.key?(:text) && options[:text].nil? - options[:template] ||= (options[:action] || action_name).to_s options end diff --git a/actionpack/lib/action_controller/metal/rendering.rb b/actionpack/lib/action_controller/metal/rendering.rb index 70fd79bb8b..f6e9e4c4ac 100644 --- a/actionpack/lib/action_controller/metal/rendering.rb +++ b/actionpack/lib/action_controller/metal/rendering.rb @@ -44,6 +44,10 @@ module ActionController options[:text] = options[:text].to_text end + if options.delete(:nothing) || (options.key?(:text) && options[:text].nil?) + options[:text] = " " + end + if options[:status] options[:status] = Rack::Utils.status_code(options[:status]) end -- cgit v1.2.3 From a977b2588e46ab5b9b8a1cb2a8f7482988c64486 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sun, 15 Jan 2012 15:47:45 -0200 Subject: Remove method missing handling when action is not found, use action missing instead Do not create a method_missing method to handle not found actions, use the action_missing method provided by Rails instead. --- .../lib/action_controller/metal/compatibility.rb | 8 ---- actionpack/test/controller/base_test.rb | 45 ---------------------- 2 files changed, 53 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index 835d1f7e35..96707b6587 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -17,13 +17,5 @@ module ActionController def render_to_body(options) super || " " end - - def _handle_method_missing - method_missing(@_action_name.to_sym) - end - - def method_for_action(action_name) - super || (respond_to?(:method_missing) && "_handle_method_missing") - end end end diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb index bda80d1c20..b95a524612 100644 --- a/actionpack/test/controller/base_test.rb +++ b/actionpack/test/controller/base_test.rb @@ -40,29 +40,6 @@ class NonEmptyController < ActionController::Base end end -class MethodMissingController < ActionController::Base - hide_action :shouldnt_be_called - def shouldnt_be_called - raise "NO WAY!" - end - -protected - - def method_missing(selector) - render :text => selector.to_s - end -end - -class AnotherMethodMissingController < ActionController::Base - cattr_accessor :_exception - rescue_from Exception, :with => :_exception= - - protected - def method_missing(*attrs, &block) - super - end -end - class DefaultUrlOptionsController < ActionController::Base def from_view render :inline => "<%= #{params[:route]} %>" @@ -159,28 +136,6 @@ class PerformActionTest < ActionController::TestCase assert_equal exception.message, "The action 'non_existent' could not be found for EmptyController" end - def test_get_on_priv_should_show_selector - use_controller MethodMissingController - get :shouldnt_be_called - assert_response :success - assert_equal 'shouldnt_be_called', @response.body - end - - def test_method_missing_is_not_an_action_name - use_controller MethodMissingController - assert !@controller.__send__(:action_method?, 'method_missing') - - get :method_missing - assert_response :success - assert_equal 'method_missing', @response.body - end - - def test_method_missing_should_recieve_symbol - use_controller AnotherMethodMissingController - get :some_action - assert_kind_of NameError, @controller._exception - end - def test_get_on_hidden_should_fail use_controller NonEmptyController assert_raise(AbstractController::ActionNotFound) { get :hidden_action } -- cgit v1.2.3 From 67c96ab024f008ad1aee8345c1ae0fd7aa9bf072 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sun, 15 Jan 2012 22:07:20 -0200 Subject: Move render_to_body logic to return a spaced string to AC::Rendering This seems to be required only when calling render :partial with an empty collection from a controller. This call happens to return no content, letting the response body empty, which means to Rails that it should go on and try to find a template to render based on the current action name, thus failing hard. Although tests keep all green, we need to check a better way to fix this. --- actionpack/lib/action_controller/metal/compatibility.rb | 4 ---- actionpack/lib/action_controller/metal/rendering.rb | 4 ++++ actionpack/lib/action_controller/metal/streaming.rb | 2 +- actionpack/lib/action_view/test_case.rb | 2 -- actionpack/test/controller/filters_test.rb | 2 -- 5 files changed, 5 insertions(+), 9 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index 96707b6587..813b6501d1 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -13,9 +13,5 @@ module ActionController :@_view_runtime, :@_stream, :@_url_options, :@_action_has_layout ] end - - def render_to_body(options) - super || " " - end end end diff --git a/actionpack/lib/action_controller/metal/rendering.rb b/actionpack/lib/action_controller/metal/rendering.rb index f6e9e4c4ac..a677cdf15d 100644 --- a/actionpack/lib/action_controller/metal/rendering.rb +++ b/actionpack/lib/action_controller/metal/rendering.rb @@ -29,6 +29,10 @@ module ActionController self.response_body = nil end + def render_to_body(*) + super || " " + end + private # Normalize arguments by catching blocks and setting them on :update. diff --git a/actionpack/lib/action_controller/metal/streaming.rb b/actionpack/lib/action_controller/metal/streaming.rb index 0e46402962..e9783e6919 100644 --- a/actionpack/lib/action_controller/metal/streaming.rb +++ b/actionpack/lib/action_controller/metal/streaming.rb @@ -216,7 +216,7 @@ module ActionController #:nodoc: end end - # Call render_to_body if we are streaming instead of usual +render+. + # Call render_body if we are streaming instead of usual +render+. def _render_template(options) #:nodoc: if options.delete(:stream) Rack::Chunked::Body.new view_renderer.render_body(view_context, options) diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb index c734c914db..b00f69e636 100644 --- a/actionpack/lib/action_view/test_case.rb +++ b/actionpack/lib/action_view/test_case.rb @@ -233,10 +233,8 @@ module ActionView super end end - end include Behavior - end end diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index c64628890e..046396b37c 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -815,8 +815,6 @@ class FilterTest < ActionController::TestCase end end - - class PostsController < ActionController::Base module AroundExceptions class Error < StandardError ; end -- cgit v1.2.3 From cb650a50bfc561dc00dfc844dac01beeab05bd00 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Tue, 17 Jan 2012 08:56:50 -0200 Subject: Remove deprecated default_charset= from AC::Base This should be set globally as a configuration, using `config.action_dispatch.default_charset` instead --- actionpack/lib/action_controller/metal/compatibility.rb | 4 ---- actionpack/lib/action_dispatch/railtie.rb | 3 ++- actionpack/test/controller/content_type_test.rb | 8 ++++---- 3 files changed, 6 insertions(+), 9 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index 813b6501d1..0f43bc8cce 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -4,10 +4,6 @@ module ActionController # Temporary hax included do - class << self - delegate :default_charset=, :to => "ActionDispatch::Response" - end - self.protected_instance_variables = [ :@_status, :@_headers, :@_params, :@_env, :@_response, :@_request, :@_view_runtime, :@_stream, :@_url_options, :@_action_has_layout diff --git a/actionpack/lib/action_dispatch/railtie.rb b/actionpack/lib/action_dispatch/railtie.rb index 46c06386d8..35f901c575 100644 --- a/actionpack/lib/action_dispatch/railtie.rb +++ b/actionpack/lib/action_dispatch/railtie.rb @@ -11,6 +11,7 @@ module ActionDispatch config.action_dispatch.ignore_accept_header = false config.action_dispatch.rescue_templates = { } config.action_dispatch.rescue_responses = { } + config.action_dispatch.default_charset = nil config.action_dispatch.rack_cache = { :metastore => "rails:/", @@ -21,7 +22,7 @@ module ActionDispatch initializer "action_dispatch.configure" do |app| ActionDispatch::Http::URL.tld_length = app.config.action_dispatch.tld_length ActionDispatch::Request.ignore_accept_header = app.config.action_dispatch.ignore_accept_header - ActionDispatch::Response.default_charset = app.config.encoding + ActionDispatch::Response.default_charset = app.config.action_dispatch.default_charset || app.config.encoding ActionDispatch::ExceptionWrapper.rescue_responses.merge!(config.action_dispatch.rescue_responses) ActionDispatch::ExceptionWrapper.rescue_templates.merge!(config.action_dispatch.rescue_templates) diff --git a/actionpack/test/controller/content_type_test.rb b/actionpack/test/controller/content_type_test.rb index b57f3f1bb5..03d5d27cf4 100644 --- a/actionpack/test/controller/content_type_test.rb +++ b/actionpack/test/controller/content_type_test.rb @@ -68,12 +68,12 @@ class ContentTypeTest < ActionController::TestCase end def test_render_changed_charset_default - OldContentTypeController.default_charset = "utf-16" + ActionDispatch::Response.default_charset = "utf-16" get :render_defaults assert_equal "utf-16", @response.charset assert_equal Mime::HTML, @response.content_type ensure - OldContentTypeController.default_charset = "utf-8" + ActionDispatch::Response.default_charset = "utf-8" end # :ported: @@ -105,12 +105,12 @@ class ContentTypeTest < ActionController::TestCase end def test_nil_default_for_erb - OldContentTypeController.default_charset = nil + ActionDispatch::Response.default_charset = nil get :render_default_for_erb assert_equal Mime::HTML, @response.content_type assert_nil @response.charset, @response.headers.inspect ensure - OldContentTypeController.default_charset = "utf-8" + ActionDispatch::Response.default_charset = "utf-8" end def test_default_for_erb -- cgit v1.2.3 From 0b7548fab17c8f50d9bc6ed7e98ef475d73010cc Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Tue, 17 Jan 2012 08:59:42 -0200 Subject: Move protected instance variables definition, kill compatibility module --- actionpack/lib/action_controller/base.rb | 7 +++++-- actionpack/lib/action_controller/metal/compatibility.rb | 13 ------------- 2 files changed, 5 insertions(+), 15 deletions(-) delete mode 100644 actionpack/lib/action_controller/metal/compatibility.rb (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index f570a7565c..3b82231b15 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -228,8 +228,11 @@ module ActionController include mod end - # Rails 2.x compatibility - include ActionController::Compatibility + # Define some internal variables that should not be propagated to the view. + self.protected_instance_variables = [ + :@_status, :@_headers, :@_params, :@_env, :@_response, :@_request, + :@_view_runtime, :@_stream, :@_url_options, :@_action_has_layout + ] ActiveSupport.run_load_hooks(:action_controller, self) end diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb deleted file mode 100644 index 0f43bc8cce..0000000000 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ /dev/null @@ -1,13 +0,0 @@ -module ActionController - module Compatibility - extend ActiveSupport::Concern - - # Temporary hax - included do - self.protected_instance_variables = [ - :@_status, :@_headers, :@_params, :@_env, :@_response, :@_request, - :@_view_runtime, :@_stream, :@_url_options, :@_action_has_layout - ] - end - end -end -- cgit v1.2.3 From e5e9a4cc7615a8b60cd90d8754231df709f39e6c Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Tue, 17 Jan 2012 09:14:17 -0200 Subject: Bring back rendering templates that start with / in nested structures --- actionpack/lib/action_view/lookup_context.rb | 1 + .../controller/new_base/render_template_test.rb | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) (limited to 'actionpack') diff --git a/actionpack/lib/action_view/lookup_context.rb b/actionpack/lib/action_view/lookup_context.rb index 90d88ca967..90c4a2759a 100644 --- a/actionpack/lib/action_view/lookup_context.rb +++ b/actionpack/lib/action_view/lookup_context.rb @@ -152,6 +152,7 @@ module ActionView def normalize_name(name, prefixes) #:nodoc: prefixes = nil if prefixes.blank? parts = name.to_s.split('/') + parts.shift if parts.first.empty? name = parts.pop return name, prefixes || [""] if parts.empty? diff --git a/actionpack/test/controller/new_base/render_template_test.rb b/actionpack/test/controller/new_base/render_template_test.rb index 88f8cc0d6e..ade204c387 100644 --- a/actionpack/test/controller/new_base/render_template_test.rb +++ b/actionpack/test/controller/new_base/render_template_test.rb @@ -201,4 +201,26 @@ module RenderTemplate assert_status 200 end end + + module Compatibility + class WithoutLayoutController < ActionController::Base + self.view_paths = [ActionView::FixtureResolver.new( + "test/basic.html.erb" => "Hello from basic.html.erb", + "shared.html.erb" => "Elastica" + )] + + def with_forward_slash + render :template => "/test/basic" + end + end + + class TestTemplateRenderWithForwardSlash < Rack::TestCase + test "rendering a normal template with full path starting with a leading slash" do + get "/render_template/compatibility/without_layout/with_forward_slash" + + assert_body "Hello from basic.html.erb" + assert_status 200 + end + end + end end -- cgit v1.2.3 From 96a817fb2c5ca32c69469a9d2dc13630d8fa5e8a Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Tue, 17 Jan 2012 11:06:10 -0200 Subject: Update changelog --- actionpack/CHANGELOG.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index cc09bcb771..6bff470003 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -21,6 +21,21 @@ ## Rails 3.2.0 (unreleased) ## +* Add `config.action_dispatch.default_charset` to configure default charset for ActionDispatch::Response. *Carlos Antonio da Silva* + +* Deprecate setting default charset at controller level, use the new `config.action_dispatch.default_charset` instead. *Carlos Antonio da Silva* + +* Deprecate ActionController::UnknownAction in favour of AbstractController::ActionNotFound. *Carlos Antonio da Silva* + +* Deprecate ActionController::DoubleRenderError in favour of AbstractController::DoubleRenderError. *Carlos Antonio da Silva* + +* Deprecate method_missing handling for not found actions, use action_missing instead. *Carlos Antonio da Silva* + +* Deprecate ActionController#performed?, check for response_body presence instead. *Carlos Antonio da Silva* + +* Deprecate ActionController#rescue_action, ActionController#initialize_template_class, and ActionController#assign_shortcuts. + These methods were not being used internally anymore and are going to be removed in Rails 4. *Carlos Antonio da Silva* + * Use a BodyProxy instead of including a Module that responds to close. Closes #4441 if Active Record is disabled assets are delivered correctly *Santiago Pastorino* @@ -45,7 +60,7 @@ <%= f.button %> <% end %> -* Date helpers accept a new option, `:use_two_digit_numbers = true`, that renders select boxes for months and days with a leading zero without changing the respective values. +* Date helpers accept a new option, `:use_two_digit_numbers = true`, that renders select boxes for months and days with a leading zero without changing the respective values. For example, this is useful for displaying ISO8601-style dates such as '2011-08-01'. *Lennart Fridén and Kim Persson* * Make ActiveSupport::Benchmarkable a default module for ActionController::Base, so the #benchmark method is once again available in the controller context like it used to be *DHH* -- cgit v1.2.3