From b37f489024d812b236df826dbb1df1d172a35539 Mon Sep 17 00:00:00 2001 From: Dmitry Vazhov Date: Mon, 20 Apr 2009 22:46:30 +0400 Subject: [PATCH] action controller#method_missing should receive symbol as an argument --- actionpack/lib/action_controller/base/base.rb | 2 +- actionpack/test/controller/base_test.rb | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletions(-) diff --git a/actionpack/lib/action_controller/base/base.rb b/actionpack/lib/action_controller/base/base.rb index 3000b3d..b84585e 100644 --- a/actionpack/lib/action_controller/base/base.rb +++ b/actionpack/lib/action_controller/base/base.rb @@ -855,7 +855,7 @@ module ActionController #:nodoc: if called = action_methods.include?(action_name) ret = send(action_name) elsif called = respond_to?(:method_missing) - ret = method_missing(action_name) + ret = method_missing(action_name.to_sym) end return (performed? ? ret : default_render) if called diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb index f4517d0..f7ed7e7 100644 --- a/actionpack/test/controller/base_test.rb +++ b/actionpack/test/controller/base_test.rb @@ -49,6 +49,16 @@ protected 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 default_url_options_action end @@ -149,6 +159,12 @@ class PerformActionTest < ActionController::TestCase 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 get :hidden_action -- 1.6.0.2