Sha256: c4e12237727dce0c801105d0125a68263c3aede2076fe1f8b0794b71f97a1d30
Contents?: true
Size: 785 Bytes
Versions: 31
Compression:
Stored size: 785 Bytes
Contents
module Locomotive::Steam module Models class ManyToManyAssociation < ReferencedAssociation def __load__ key = @repository.k(:_id, :in) @repository.local_conditions[key] = @entity[__target_key__] || [] # use order_by from options as the default one for further queries @repository.local_conditions[:order_by] = @options[:order_by] unless @options[:order_by].blank? # all the further calls (method_missing) will be delegated to @repository @repository end def __serialize__(attributes) attributes[__target_key__] = attributes[__name__].try(:map, &:_id) attributes.delete(__name__) end def __target_key__ :"#{__name__.to_s.singularize}_ids" end end end end
Version data entries
31 entries across 31 versions & 1 rubygems