Skip to content

Commit

Permalink
Missing method error doesn't specify which controller it is missing f…
Browse files Browse the repository at this point in the history
…rom [#4436 state:resolved]

The error page shown when the method you are requesting on a controller
doesn't specify which controller the method is missing from

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
aussiegeek authored and josevalim committed Jun 10, 2010
1 parent 51590ad commit 566967e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion actionpack/lib/abstract_controller/base.rb
Expand Up @@ -106,7 +106,7 @@ def process(action, *args)
@_action_name = action_name = action.to_s

unless action_name = method_for_action(action_name)
raise ActionNotFound, "The action '#{action}' could not be found"
raise ActionNotFound, "The action '#{action}' could not be found for #{self.class.name}"
end

@_response_body = nil
Expand Down
11 changes: 10 additions & 1 deletion actionpack/test/controller/base_test.rb
Expand Up @@ -90,6 +90,7 @@ class RecordIdentifierController < ActionController::Base
end

class ControllerClassTests < ActiveSupport::TestCase

def test_controller_path
assert_equal 'empty', EmptyController.controller_path
assert_equal EmptyController.controller_path, EmptyController.new.controller_path
Expand Down Expand Up @@ -166,7 +167,15 @@ def use_controller(controller_class)

rescue_action_in_public!
end


def test_process_should_be_precise
use_controller EmptyController
exception = assert_raise AbstractController::ActionNotFound do
get :non_existent
end
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
Expand Down

0 comments on commit 566967e

Please sign in to comment.