1
0
Fork 0
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:
Mark Burns 2012-03-03 13:57:56 +00:00
parent 051dec8360
commit 08718df5c4

View file

@ -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)