Method: Sequel::Model::Associations::OneToManyAssociationReflection#can_have_associated_objects?

Defined in:
lib/sequel/model/associations.rb

#can_have_associated_objects?(obj) ⇒ Boolean

one_to_many associations can only have associated objects if none of the :keys options have a nil value.

Returns:

  • (Boolean)
[View source]

1038
1039
1040
# File 'lib/sequel/model/associations.rb', line 1038

def can_have_associated_objects?(obj)
  !self[:primary_keys].any?{|k| obj.get_column_value(k).nil?}
end