lib/rails_ops/operation/model/load.rb in rails_ops-1.5.4 vs lib/rails_ops/operation/model/load.rb in rails_ops-1.5.5

- old
+ new

@@ -38,10 +38,14 @@ def self.lock_model_at_build? _lock_model_at_build.nil? ? RailsOps.config.lock_models_at_build? : _lock_model_at_build end + def lock_model_at_build? + self.class._lock_model_at_build? + end + # Method to set the lock mode, which can either be :exclusive to use # an exclusive write lock, or :shared to use a shared lock. Please note # that currently, :shared only works for MySql, Postgresql and Oracle DB, # other adapters always use the exclusive lock. def self.lock_mode(lock_mode) @@ -91,10 +95,10 @@ private def lock_relation(relation) # Directly return the relation if we don't want to lock the relation - return relation unless self.class.lock_model_at_build? + return relation unless lock_model_at_build? if self.class.lock_mode_or_default == :shared # Lock the relation in shared mode return relation.lock(shared_lock_statement) else