aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-01-15 15:47:45 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-01-17 10:04:38 -0200
commita977b2588e46ab5b9b8a1cb2a8f7482988c64486 (patch)
tree8933bfc09028605c45bbc34bff91acdbb2c2ad8d /actionpack
parent53596d091390bda7fb9b78ad838273a9e63fbde1 (diff)
downloadrails-a977b2588e46ab5b9b8a1cb2a8f7482988c64486.tar.gz
rails-a977b2588e46ab5b9b8a1cb2a8f7482988c64486.tar.bz2
rails-a977b2588e46ab5b9b8a1cb2a8f7482988c64486.zip
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.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/metal/compatibility.rb8
-rw-r--r--actionpack/test/controller/base_test.rb45
2 files changed, 0 insertions, 53 deletions
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 }