Sha256: 1d8fbc441ec787bacbdbcbb48b43b939ca705fc537b07242c9fe9da4bf40c7c8
Contents?: true
Size: 623 Bytes
Versions: 20
Compression:
Stored size: 623 Bytes
Contents
module Superstore module Scoping extend ActiveSupport::Concern included do singleton_class.class_eval do delegate :find, :find_by_id, :first, :all, to: :scope delegate :find_each, :find_in_batches, to: :scope delegate :select, :where, :where_ids, to: :scope end end module ClassMethods def scope self.current_scope ||= Scope.new(self) end def current_scope Thread.current["#{self}_current_scope"] end def current_scope=(new_scope) Thread.current["#{self}_current_scope"] = new_scope end end end end
Version data entries
20 entries across 20 versions & 1 rubygems