Module: Axel::ServiceResource::Associations
- Defined in:
- app/models/axel/service_resource/associations.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'app/models/axel/service_resource/associations.rb', line 8
def method_missing(method_name, *args, &block)
if self.class.associations_respond_to?(method_name)
cache_association method_name do
self.class.association(method_name).run_method(self, method_name, *args, &block)
end
else
super
end
end
|
Class Method Details
.included(base) ⇒ Object
4
5
6
|
# File 'app/models/axel/service_resource/associations.rb', line 4
def self.included(base)
base.extend(ClassMethods)
end
|
Instance Method Details
#reset_association_cache! ⇒ Object
22
23
24
|
# File 'app/models/axel/service_resource/associations.rb', line 22
def reset_association_cache!
@association_cache = {}
end
|
#respond_to?(method_name, include_private = false) ⇒ Boolean
18
19
20
|
# File 'app/models/axel/service_resource/associations.rb', line 18
def respond_to?(method_name, include_private = false)
self.class.associations_respond_to?(method_name) || super
end
|