Skip to content

Commit

Permalink
Import ActionController::MissingRenderer from Rails
Browse files Browse the repository at this point in the history
  • Loading branch information
zzak committed Jan 12, 2025
1 parent 9bdc60d commit bdf7d11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/action_controller/responder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ class Responder
put: :edit
}

# See Responder#api_behavior
class MissingRenderer < LoadError
def initialize(format)
super "No renderer defined for format: #{format}"
end
end

def initialize(controller, resources, options = {})
@controller = controller
@request = @controller.request
Expand Down
2 changes: 1 addition & 1 deletion test/action_controller/respond_with_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ def test_using_resource_with_set_responder

def test_raises_missing_renderer_if_an_api_behavior_with_no_renderer
@controller = CsvRespondWithController.new
assert_raise ActionController::MissingRenderer do
assert_raise ActionController::Responder::MissingRenderer do
get :index, format: "csv"
end
end
Expand Down

0 comments on commit bdf7d11

Please sign in to comment.