Skip to content

Commit

Permalink
Merge pull request #9802 from newsline/fix-broken-action-missing
Browse files Browse the repository at this point in the history
Fix missing action_missing

Conflicts:
	actionpack/CHANGELOG.md

Conflicts:
	actionpack/test/controller/base_test.rb

Fixes #9799
  • Loading branch information
rafaelfranca committed Mar 20, 2013
1 parent 7e8a74d commit 2c8f349
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions actionpack/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/metal/hide_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def hide_action(*args)
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
Expand Down
12 changes: 12 additions & 0 deletions actionpack/test/controller/base_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ def url_options
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
Expand Down Expand Up @@ -196,6 +202,12 @@ def test_get_on_hidden_should_fail
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
Expand Down

0 comments on commit 2c8f349

Please sign in to comment.