Class | Sequel::Model::Associations::OneToManyAssociationReflection |
In: |
lib/sequel/model/associations.rb
|
Parent: | AssociationReflection |
FINALIZE_SETTINGS | = | superclass::FINALIZE_SETTINGS.merge( :qualified_primary_key=>:qualified_primary_key |
Support a correlated subquery limit strategy when using eager_graph.
# File lib/sequel/model/associations.rb, line 964 964: def apply_eager_graph_limit_strategy(strategy, ds) 965: case strategy 966: when :correlated_subquery 967: apply_correlated_subquery_limit_strategy(ds) 968: else 969: super 970: end 971: end
The keys in the associated model‘s table related to this association
# File lib/sequel/model/associations.rb, line 974 974: def associated_object_keys 975: self[:keys] 976: end
one_to_many associations can only have associated objects if none of the :keys options have a nil value.
# File lib/sequel/model/associations.rb, line 980 980: def can_have_associated_objects?(obj) 981: !self[:primary_keys].any?{|k| obj.get_column_value(k).nil?} 982: end
one_to_many and one_to_one associations can be clones
# File lib/sequel/model/associations.rb, line 985 985: def cloneable?(ref) 986: ref[:type] == :one_to_many || ref[:type] == :one_to_one 987: end
Default foreign key name symbol for key in associated table that points to current table‘s primary key.
# File lib/sequel/model/associations.rb, line 991 991: def default_key 992: 993: "#{underscore(demodulize(self[:model].name))}_id" 994: end
# File lib/sequel/model/associations.rb, line 998 998: def finalize_settings 999: FINALIZE_SETTINGS 1000: end
Handle silent failure of add/remove methods if raise_on_save_failure is false.
# File lib/sequel/model/associations.rb, line 1003 1003: def handle_silent_modification_failure? 1004: self[:raise_on_save_failure] == false 1005: end
The hash key to use for the eager loading predicate (left side of IN (1, 2, 3))
# File lib/sequel/model/associations.rb, line 1008 1008: def predicate_key 1009: cached_fetch(:predicate_key){qualify_assoc(self[:key])} 1010: end
The column in the current table that the key in the associated table references.
# File lib/sequel/model/associations.rb, line 1014 1014: def primary_key 1015: self[:primary_key] 1016: end
primary_key qualified by the current table
# File lib/sequel/model/associations.rb, line 1019 1019: def qualified_primary_key 1020: cached_fetch(:qualified_primary_key){qualify_cur(primary_key)} 1021: end
Whether the reciprocal of this association returns an array of objects instead of a single object, false for a one_to_many association.
# File lib/sequel/model/associations.rb, line 1025 1025: def reciprocal_array? 1026: false 1027: end
Destroying one_to_many associated objects automatically deletes the foreign key.
# File lib/sequel/model/associations.rb, line 1030 1030: def remove_before_destroy? 1031: false 1032: end
The one_to_many association needs to check that an object to be removed already is associated.
# File lib/sequel/model/associations.rb, line 1035 1035: def remove_should_check_existing? 1036: true 1037: end