Method: Sequel::Model::Associations::AssociationReflection#finalize
- Defined in:
- lib/sequel/model/associations.rb
#finalize ⇒ Object
Finalize the association by first attempting to populate the thread-safe cache, and then transfering the thread-safe cache value to the association itself, so that a mutex is not needed to get the value.
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
# File 'lib/sequel/model/associations.rb', line 376 def finalize return unless cache = self[:cache] finalizer = proc do |meth, key| next if has_key?(key) # Allow calling private methods to make sure caching is done appropriately send(meth) self[key] = cache.delete(key) if cache.has_key?(key) end finalize_settings.each(&finalizer) unless self[:instance_specific] finalizer.call(:associated_eager_dataset, :associated_eager_dataset) finalizer.call(:filter_by_associations_conditions_dataset, :filter_by_associations_conditions_dataset) end nil end |