class JsonApiResource::Associations::HasManyPrefetched
Public Instance Methods
callable?( root_instance )
click to toggle source
# File lib/json_api_resource/associations/has_many_prefetched.rb, line 16 def callable?( root_instance ) root_instance.send(key).present? end
default_action()
click to toggle source
# File lib/json_api_resource/associations/has_many_prefetched.rb, line 4 def default_action :where end
nil_default()
click to toggle source
# File lib/json_api_resource/associations/has_many_prefetched.rb, line 20 def nil_default [] end
query( root_instance )
click to toggle source
# File lib/json_api_resource/associations/has_many_prefetched.rb, line 12 def query( root_instance ) { id: root_instance.send(key) }.merge(opts) end
server_key()
click to toggle source
# File lib/json_api_resource/associations/has_many_prefetched.rb, line 8 def server_key @opts[:prefetched_ids] end
type()
click to toggle source
# File lib/json_api_resource/associations/has_many_prefetched.rb, line 24 def type JsonApiResource::Associations::HAS_MANY_PREFETCHED end
validate_options()
click to toggle source
Calls superclass method
JsonApiResource::Associations::Base#validate_options
# File lib/json_api_resource/associations/has_many_prefetched.rb, line 28 def validate_options raise_unless key == server_key, "#{root}.#{name} cannot specify both prefetched_ids and a foreign key" super end