Skip to content

Commit

Permalink
Fix wrong argument in MainController#respond_to_missing?
Browse files Browse the repository at this point in the history
Fixes #3454
  • Loading branch information
mshibuya committed Jan 5, 2022
1 parent e65ec93 commit da51b91
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/rails_admin/main_controller.rb
Expand Up @@ -49,7 +49,7 @@ def method_missing(name, *args, &block)
end

def respond_to_missing?(sym, include_private)
if RailsAdmin::Config::Actions.find(name.to_sym)
if RailsAdmin::Config::Actions.find(sym)
true
else
super
Expand Down
7 changes: 7 additions & 0 deletions spec/controllers/rails_admin/main_controller_spec.rb
Expand Up @@ -190,6 +190,13 @@ def get(action, params)
end
end

describe '#respond_to_missing?' do
it 'returns the result based on existence of action' do
expect(controller.send(:respond_to_missing?, :index, false)).to be true
expect(controller.send(:respond_to_missing?, :invalid_action, false)).to be false
end
end

describe '#get_collection' do
let(:team) { FactoryBot.create :team }
let!(:player) { FactoryBot.create :player, team: team }
Expand Down

0 comments on commit da51b91

Please sign in to comment.