Class: JsonApiResource::Associations::BelongsTo
- Inherits:
-
Base
- Object
- Base
- JsonApiResource::Associations::BelongsTo
show all
- Defined in:
- lib/json_api_resource/associations/belongs_to.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
16
17
18
|
# File 'lib/json_api_resource/associations/belongs_to.rb', line 16
def callable?( root_instance )
root_instance.send(key).present?
end
|
#default_action ⇒ Object
4
5
6
|
# File 'lib/json_api_resource/associations/belongs_to.rb', line 4
def default_action
:find
end
|
#nil_default ⇒ Object
20
21
22
|
# File 'lib/json_api_resource/associations/belongs_to.rb', line 20
def nil_default
nil
end
|
#query(root_instance) ⇒ Object
12
13
14
|
# File 'lib/json_api_resource/associations/belongs_to.rb', line 12
def query( root_instance )
root_instance.send key
end
|
#server_key ⇒ Object
8
9
10
|
# File 'lib/json_api_resource/associations/belongs_to.rb', line 8
def server_key
"#{name}_id"
end
|