Sha256: 3a9d7e0080f7fc3d12ed2aac101cfad9bc5bc8eb2980db73f135566c8cae7cb9
Contents?: true
Size: 650 Bytes
Versions: 14
Compression:
Stored size: 650 Bytes
Contents
module Graphiti module Adapters module ActiveRecord class ManyToManySideload < Sideload::ManyToMany def through_table_name @through_table_name ||= parent_resource_class.model .reflections[through.to_s].klass.table_name end def through_relationship_name foreign_key.keys.first end def infer_foreign_key parent_model = parent_resource_class.model key = parent_model.reflections[name.to_s].options[:through] value = parent_model.reflections[key.to_s].foreign_key.to_sym { key => value } end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems