mirror of
https://github.com/drapergem/draper
synced 2023-03-27 23:21:17 -04:00
refactor of method_missing for ease of reading
This commit is contained in:
parent
051dec8360
commit
08718df5c4
1 changed files with 9 additions and 12 deletions
|
@ -202,19 +202,16 @@ module Draper
|
|||
end
|
||||
|
||||
def method_missing(method, *args, &block)
|
||||
if allow?(method)
|
||||
begin
|
||||
self.class.send :define_method, method do |*args, &block|
|
||||
model.send(method, *args, &block)
|
||||
end
|
||||
self.send(method, *args, &block)
|
||||
rescue NoMethodError => no_method_error
|
||||
super if no_method_error.name == method
|
||||
raise no_method_error
|
||||
end
|
||||
else
|
||||
super
|
||||
super unless allow?(method)
|
||||
|
||||
self.class.send :define_method, method do |*args, &block|
|
||||
model.send(method, *args, &block)
|
||||
end
|
||||
self.send(method, *args, &block)
|
||||
|
||||
rescue NoMethodError => no_method_error
|
||||
super if no_method_error.name == method
|
||||
raise no_method_error
|
||||
end
|
||||
|
||||
def self.method_missing(method, *args, &block)
|
||||
|
|
Loading…
Add table
Reference in a new issue