Sha256: bdd2a25bebc10e35217fe49cbb974ef04d613c6b6bd5640dc011e3a88a364d88
Contents?: true
Size: 699 Bytes
Versions: 5
Compression:
Stored size: 699 Bytes
Contents
# frozen_string_literal: true module Dynamoid #:nodoc: # The has_many association. module Associations class HasMany include ManyAssociation private # Find the target association, always a :belongs_to association. Uses either options[:inverse_of] or the source class name # and default parsing to return the most likely name for the target association. # # @since 0.2.0 def target_association key_name = options[:inverse_of] || source.class.to_s.singularize.underscore.to_sym guess = target_class.associations[key_name] return nil if guess.nil? || guess[:type] != :belongs_to key_name end end end end
Version data entries
5 entries across 5 versions & 1 rubygems