lib/sequel/model.rb in sequel-3.34.1 vs lib/sequel/model.rb in sequel-3.35.0

- old
+ new

@@ -33,20 +33,20 @@ # # Using a database # class Comment < Sequel::Model(DB1) # dataset # => DB1[:comments] # end def self.Model(source) - if Sequel::Model.cache_anonymous_models && (klass = Model::ANONYMOUS_MODEL_CLASSES[source]) + if Sequel::Model.cache_anonymous_models && (klass = Sequel.synchronize{Model::ANONYMOUS_MODEL_CLASSES[source]}) return klass end klass = if source.is_a?(Database) c = Class.new(Model) c.db = source c else Class.new(Model).set_dataset(source) end - Model::ANONYMOUS_MODEL_CLASSES[source] = klass if Sequel::Model.cache_anonymous_models + Sequel.synchronize{Model::ANONYMOUS_MODEL_CLASSES[source] = klass} if Sequel::Model.cache_anonymous_models klass end # <tt>Sequel::Model</tt> is an object relational mapper built on top of Sequel core. Each # model class is backed by a dataset instance, and many dataset methods can be