Sha256: 38d9327a950e61116ee1e9bbd04323488af75ed1ca4fe05cfbe0d4e84e04aac6
Contents?: true
Size: 705 Bytes
Versions: 7
Compression:
Stored size: 705 Bytes
Contents
# frozen_string_literal: true module Dynamoid # The has_many association. module Associations # @private 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
7 entries across 7 versions & 1 rubygems