Methods that turn an association that returns multiple objects into an association that returns a single object.
Public Instance methods
Singular associations do not assign singular if they are using the ruby eager limit strategy and have a slice range, since they need to store the array of associated objects in order to pick the correct one with an offset.
# File lib/sequel/model/associations.rb 1167 def assign_singular? 1168 super && (eager_limit_strategy != :ruby || !slice_range) 1169 end
Add conditions when filtering by singular associations with orders, since the underlying relationship is probably not one-to-one.
# File lib/sequel/model/associations.rb 1173 def filter_by_associations_add_conditions? 1174 super || self[:order] || self[:eager_limit_strategy] || self[:filter_limit_strategy] 1175 end
Make sure singular associations always have 1 as the limit
# File lib/sequel/model/associations.rb 1178 def limit_and_offset 1179 r = super 1180 if r.first == 1 1181 r 1182 else 1183 [1, r] 1184 end 1185 end
Singular associations always return a single object, not an array.
# File lib/sequel/model/associations.rb 1188 def returns_array? 1189 false 1190 end