class JsonApiResource::Associations::HasOne

Public Instance Methods

callable?( root_instance ) click to toggle source
# File lib/json_api_resource/associations/has_one.rb, line 21
def callable?( root_instance )
  true
end
default_action() click to toggle source
# File lib/json_api_resource/associations/has_one.rb, line 8
def default_action  
  :where
end
post_process( value ) click to toggle source
# File lib/json_api_resource/associations/has_one.rb, line 4
def post_process( value )
  Array(value).first
end
query( root_instance ) click to toggle source
# File lib/json_api_resource/associations/has_one.rb, line 17
def query( root_instance )
  { key => root_instance.id }.merge(opts)
end
server_key() click to toggle source
# File lib/json_api_resource/associations/has_one.rb, line 12
def server_key
  class_name = self.root.to_s.demodulize.underscore
  "#{class_name}_id"
end
type() click to toggle source
# File lib/json_api_resource/associations/has_one.rb, line 25
def type
  JsonApiResource::Associations::HAS_ONE
end