blob: 0c3fd1bd29d0d0e611a413d8223d2ff280de0954 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
module ActiveRecord
module Scoping
extend ActiveSupport::Concern
included do
include Default
include Named
end
module ClassMethods
def current_scope #:nodoc:
Thread.current["#{self}_current_scope"]
end
def current_scope=(scope) #:nodoc:
Thread.current["#{self}_current_scope"] = scope
end
end
def populate_with_current_scope_attributes
return unless self.class.scope_attributes?
self.class.scope_attributes.each do |att,value|
send("#{att}=", value) if respond_to?("#{att}=")
end
end
end
end
|