aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-03-20 18:14:41 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-03-20 18:22:31 -0300
commit2c8f34995378e4a18711cf5f947e8465227d3748 (patch)
treec586517d5eaa0a378f7546bac398911b3f6b8148
parent7e8a74d40125be9d8afc8571ab7e28c67662c484 (diff)
downloadrails-2c8f34995378e4a18711cf5f947e8465227d3748.tar.gz
rails-2c8f34995378e4a18711cf5f947e8465227d3748.tar.bz2
rails-2c8f34995378e4a18711cf5f947e8465227d3748.zip
Merge pull request #9802 from newsline/fix-broken-action-missing
Fix missing action_missing Conflicts: actionpack/CHANGELOG.md Conflicts: actionpack/test/controller/base_test.rb Fixes #9799
-rw-r--r--actionpack/CHANGELOG.md5
-rw-r--r--actionpack/lib/action_controller/metal/hide_actions.rb2
-rw-r--r--actionpack/test/controller/base_test.rb12
3 files changed, 18 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index 8c7e3327f3..dc9555b9d1 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -1,5 +1,10 @@
## unreleased ##
+* Fixed `ActionController#action_missing` not being called.
+ Fixes #9799.
+
+ *Janko Luin*
+
* `ActiveSupport::NumberHelper#number_to_human` returns the number unaltered when
the units hash does not contain the needed key, e.g. when the number provided is less
than the largest key proivided.
diff --git a/actionpack/lib/action_controller/metal/hide_actions.rb b/actionpack/lib/action_controller/metal/hide_actions.rb
index 109484d88c..1ded166491 100644
--- a/actionpack/lib/action_controller/metal/hide_actions.rb
+++ b/actionpack/lib/action_controller/metal/hide_actions.rb
@@ -28,7 +28,7 @@ module ActionController
end
def visible_action?(action_name)
- action_methods.include?(action_name)
+ not hidden_actions.include?(action_name)
end
# Overrides AbstractController::Base#action_methods to remove any methods
diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb
index affa9a6add..a652d8ffad 100644
--- a/actionpack/test/controller/base_test.rb
+++ b/actionpack/test/controller/base_test.rb
@@ -86,6 +86,12 @@ end
class RecordIdentifierController < ActionController::Base
end
+class ActionMissingController < ActionController::Base
+ def action_missing(action)
+ render :text => "Response for #{action}"
+ end
+end
+
class ControllerClassTests < ActiveSupport::TestCase
def test_controller_path
@@ -196,6 +202,12 @@ class PerformActionTest < ActionController::TestCase
assert_raise(AbstractController::ActionNotFound) { get :hidden_action }
assert_raise(AbstractController::ActionNotFound) { get :another_hidden_action }
end
+
+ def test_action_missing_should_work
+ use_controller ActionMissingController
+ get :arbitrary_action
+ assert_equal "Response for arbitrary_action", @response.body
+ end
end
class UrlOptionsTest < ActionController::TestCase