Patch #16685 ยป 0001-Introduce-request_store-to-ensure-that-the-current-u.patch
Gemfile | ||
---|---|---|
6 | 6 |
gem "coderay", "~> 1.1.0" |
7 | 7 |
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby] |
8 | 8 |
gem "builder", "3.0.0" |
9 |
gem 'request_store' |
|
9 | 10 |
gem "mime-types" |
10 | 11 | |
11 | 12 |
# Optional gem for LDAP authentication |
app/models/user.rb | ||
---|---|---|
626 | 626 |
end |
627 | 627 | |
628 | 628 |
def self.current=(user) |
629 |
Thread.current[:current_user] = user
|
|
629 |
RequestStore.store[:current_user] = user
|
|
630 | 630 |
end |
631 | 631 | |
632 | 632 |
def self.current |
633 |
Thread.current[:current_user] ||= User.anonymous
|
|
633 |
RequestStore.store[:current_user] ||= User.anonymous
|
|
634 | 634 |
end |
635 | 635 | |
636 | 636 |
# Returns the anonymous user. If the anonymous user does not exist, it is created. There can be only |