Module: BetterRecord::InjectMethods
- Defined in:
- lib/better_record/inject_methods.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/better_record/inject_methods.rb', line 7
def method_missing(method, *args, &block)
begin
if BetterRecord.attributes[method.to_sym]
m = method.to_sym
self.class.define_method m do
BetterRecord.__send__ m
end
BetterRecord.__send__ m
else
raise NoMethodError
end
rescue NoMethodError
super(method, *args, &block)
end
end
|
Class Method Details
.included(base) ⇒ Object
3
4
5
|
# File 'lib/better_record/inject_methods.rb', line 3
def self.included(base)
base.extend self
end
|