Sha256: f05b0c7355a977b309d90699b0b66bf0716261850e89089297eecc5ec40998ad
Contents?: true
Size: 712 Bytes
Versions: 3
Compression:
Stored size: 712 Bytes
Contents
# encoding: utf-8 module Dynamoid #:nodoc: # The HasOne association. module Associations class HasOne include Association include SingleAssociation 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dynamoid-2.2.0 | lib/dynamoid/associations/has_one.rb |
dynamoid-2.1.0 | lib/dynamoid/associations/has_one.rb |
dynamoid-2.0.0 | lib/dynamoid/associations/has_one.rb |