Skip to content

Commit da51b91

Browse files
committed
Fix wrong argument in MainController#respond_to_missing?
Fixes #3454
1 parent e65ec93 commit da51b91

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

app/controllers/rails_admin/main_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def method_missing(name, *args, &block)
4949
end
5050

5151
def respond_to_missing?(sym, include_private)
52-
if RailsAdmin::Config::Actions.find(name.to_sym)
52+
if RailsAdmin::Config::Actions.find(sym)
5353
true
5454
else
5555
super

spec/controllers/rails_admin/main_controller_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,13 @@ def get(action, params)
190190
end
191191
end
192192

193+
describe '#respond_to_missing?' do
194+
it 'returns the result based on existence of action' do
195+
expect(controller.send(:respond_to_missing?, :index, false)).to be true
196+
expect(controller.send(:respond_to_missing?, :invalid_action, false)).to be false
197+
end
198+
end
199+
193200
describe '#get_collection' do
194201
let(:team) { FactoryBot.create :team }
195202
let!(:player) { FactoryBot.create :player, team: team }

0 commit comments

Comments
 (0)