lib/parallel_minion/minion.rb in parallel_minion-0.2.0 vs lib/parallel_minion/minion.rb in parallel_minion-0.2.1

- old
+ new

@@ -138,11 +138,11 @@ end tags = (logger.tags || []).dup # Copy current scopes for new thread. Only applicable for AR models - scopes = self.class.current_scopes.dup if defined?(ActiveRecord::Base) + scopes = self.class.current_scopes if defined?(ActiveRecord::Base) @thread = Thread.new(*args) do # Copy logging tags from parent thread logger.tagged(*tags) do # Set the current thread name to the description for this Minion @@ -219,11 +219,17 @@ @enabled end # Returns the current scopes for each of the models for which scopes will be # copied to the Minions - def self.current_scopes - @@scoped_classes.collect {|klass| klass.all.dup} + if ActiveRecord::VERSION::MAJOR >= 4 + def self.current_scopes + @@scoped_classes.collect {|klass| klass.all} + end + else + def self.current_scopes + @@scoped_classes.collect {|klass| klass.scoped} + end end protected @@enabled = true \ No newline at end of file