mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix broken ActionController#action_missing
A recent change introduced the assumption that all controller actions are known beforehand, which is not true when using action_missing.
This commit is contained in:
parent
66ac0c567d
commit
0dfa6cb97c
3 changed files with 18 additions and 1 deletions
|
@ -1,5 +1,10 @@
|
|||
## Rails 4.0.0 (unreleased) ##
|
||||
|
||||
* Fixed ActionController#action_missing not being called.
|
||||
Fixes GH#9799.
|
||||
|
||||
*Janko Luin*
|
||||
|
||||
* Ensure that digest authentication responds with a 401 status when a basic
|
||||
header is received.
|
||||
|
||||
|
|
|
@ -27,7 +27,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
|
||||
|
|
|
@ -68,6 +68,12 @@ class RecordIdentifierWithoutDeprecationController < ActionController::Base
|
|||
include ActionView::RecordIdentifier
|
||||
end
|
||||
|
||||
class ActionMissingController < ActionController::Base
|
||||
def action_missing(action)
|
||||
render :text => "Response for #{action}"
|
||||
end
|
||||
end
|
||||
|
||||
class ControllerClassTests < ActiveSupport::TestCase
|
||||
|
||||
def test_controller_path
|
||||
|
@ -186,6 +192,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
|
||||
|
|
Loading…
Reference in a new issue