Class: Graphiti::Adapters::ActiveRecord::HasManySideload

Inherits:
Sideload::HasMany show all
Includes:
Inference
Defined in:
lib/graphiti/adapters/active_record/has_many_sideload.rb

Constant Summary

Constants inherited from Sideload

Sideload::HOOK_ACTIONS, Sideload::TYPES

Instance Attribute Summary

Attributes inherited from Sideload

#group_name, #link, #name, #parent, #parent_resource_class, #polymorphic_as

Instance Method Summary collapse

Methods included from Inference

#infer_foreign_key

Methods inherited from Sideload::HasMany

#base_filter, #initialize, #inverse_filter, #link_filter, #load_params, #type

Methods inherited from Sideload

after_save, #always_include_resource_ids?, assign, #assign, assign_each, #assign_each, #associate, #associate_all, #association_name, #base_scope, #build_resource_proxy, #clear_resources, #create_remote_resource, #description, #disassociate, #errors, #fire_hooks!, #foreign_key, hooks, #ids_for_parents, #infer_foreign_key, #initialize, link, #link?, #link_extra_fields, #link_filter, #load, #load_params, params, #parent_resource, #performant_assign?, #polymorphic_child?, #polymorphic_has_many?, #polymorphic_has_one?, #polymorphic_parent?, pre_load, #primary_key, #readable?, #remote?, #resolve, #resource, #resource_class, #resource_class_loaded?, scope, #shared_remote?, #single?, #type, #writable?

Constructor Details

This class inherits a constructor from Graphiti::Sideload::HasMany

Instance Method Details

#default_base_scopeObject



4
5
6
# File 'lib/graphiti/adapters/active_record/has_many_sideload.rb', line 4

def default_base_scope
  resource_class.model.all
end

#scope(parent_ids) ⇒ Object



8
9
10
# File 'lib/graphiti/adapters/active_record/has_many_sideload.rb', line 8

def scope(parent_ids)
  base_scope.where(foreign_key => parent_ids)
end