Class: JsonApiResource::Associations::HasMany
- Inherits:
-
Base
- Object
- Base
- JsonApiResource::Associations::HasMany
show all
- Defined in:
- lib/json_api_resource/associations/has_many.rb
Instance Attribute Summary
Attributes inherited from Base
#action, #key, #name, #root
Instance Method Summary
collapse
Methods inherited from Base
#default_nil, #initialize, #klass, #opts, #post_process
Instance Method Details
#callable?(root_instance) ⇒ Boolean
13
14
15
|
# File 'lib/json_api_resource/associations/has_many.rb', line 13
def callable?( root_instance )
true
end
|
#default_action ⇒ Object
4
5
6
|
# File 'lib/json_api_resource/associations/has_many.rb', line 4
def default_action
:where
end
|
#query(root_instance) ⇒ Object
17
18
19
|
# File 'lib/json_api_resource/associations/has_many.rb', line 17
def query( root_instance )
{ key => root_instance.id }.merge(opts)
end
|
#server_key ⇒ Object
8
9
10
11
|
# File 'lib/json_api_resource/associations/has_many.rb', line 8
def server_key
class_name = self.root.to_s.demodulize.underscore
"#{class_name}_id"
end
|