Module: ActiveRecord::QuickRead::LiteBase
- Defined in:
- lib/activerecord/quick_read.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
79
80
81
82
83
|
# File 'lib/activerecord/quick_read.rb', line 79
def method_missing(name, *args, &block)
return super unless subject.respond_to?(name)
subject.send(name, *args, &block)
end
|
Instance Method Details
#model ⇒ Object
Since the struct that includes this module is defined within the model’s namespace
94
95
96
|
# File 'lib/activerecord/quick_read.rb', line 94
def model
self.class.module_parent
end
|
#respond_to_missing?(*args) ⇒ Boolean
85
86
87
|
# File 'lib/activerecord/quick_read.rb', line 85
def respond_to_missing?(*args)
subject.respond_to?(*args) || super
end
|
#subject ⇒ Object
89
90
91
|
# File 'lib/activerecord/quick_read.rb', line 89
def subject
@subject ||= model.from_hash(to_h)
end
|