Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mshibuya committed Mar 3, 2021
1 parent 4fe2152 commit 823c2de
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/rails_admin/adapters/active_record/abstract_object.rb
Expand Up @@ -23,8 +23,14 @@ def save(options = {validate: true})
object.save(**options)
end

def method_missing(method_name, *args, &block)
object.send(method_name, *args, &block)
if RUBY_VERSION >= '2.7'
def method_missing(method_name, *args, **kwargs, &block)
object.send(method_name, *args, **kwargs, &block)
end
else
def method_missing(method_name, *args, &block)
object.send(method_name, *args, &block)
end
end
end
end
Expand Down
Expand Up @@ -9,6 +9,14 @@
expect(object).to receive(:method_call)
abstract_object.method_call
end

context 'when the method of underlying object receives keyword arguments' do
let(:object) { Class.new { def foo(bar: 1); end }.new }

it 'does not break on proxying' do
expect { abstract_object.foo(bar: 2) }.not_to raise_error
end
end
end

describe 'create' do
Expand Down

0 comments on commit 823c2de

Please sign in to comment.