Skip to content

Commit

Permalink
Merge pull request #3232 from nard-tech/method-missing
Browse files Browse the repository at this point in the history
Unify variable of #method_missing and #respond_to?
  • Loading branch information
mshibuya authored Feb 24, 2020
2 parents dd78d5a + bb708c9 commit 353e7ed
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lib/rails_admin/adapters/active_record/abstract_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def save(options = {validate: true})
object.save(options)
end

def method_missing(name, *args, &block)
object.send(name, *args, &block)
def method_missing(method_name, *args, &block)
object.send(method_name, *args, &block)
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/rails_admin/config/lazy_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ def target
@model
end

def method_missing(method, *args, &block)
target.send(method, *args, &block)
def method_missing(method_name, *args, &block)
target.send(method_name, *args, &block)
end

def respond_to?(method, include_private = false)
super || target.respond_to?(method, include_private)
def respond_to?(method_name, include_private = false)
super || target.respond_to?(method_name, include_private)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/rails_admin/config/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ def pluralize(count)

# Act as a proxy for the base section configuration that actually
# store the configurations.
def method_missing(m, *args, &block)
send(:base).send(m, *args, &block)
def method_missing(method_name, *args, &block)
send(:base).send(method_name, *args, &block)
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/rails_admin/config/proxyable/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ def bind(key, value = nil)
self
end

def method_missing(name, *args, &block)
if @object.respond_to?(name)
def method_missing(method_name, *args, &block)
if @object.respond_to?(method_name)
reset = @object.bindings
begin
@object.bindings = @bindings
response = @object.__send__(name, *args, &block)
response = @object.__send__(method_name, *args, &block)
ensure
@object.bindings = reset
end
response
else
super(name, *args, &block)
super(method_name, *args, &block)
end
end
end
Expand Down

0 comments on commit 353e7ed

Please sign in to comment.