Commit 2c03609d704fa6f6c6922d57231119ed2c8c9644
1 parent
5c82d114
Exists in
staging
and in
2 other branches
Revert "Workaround for empty sessions with active record session store"
This reverts commit a1e9a84903d733877a1a1016423709d9e92c20c8.
Showing
2 changed files
with
3 additions
and
13 deletions
Show diff stats
app/models/session.rb
1 | class Session < ActiveRecord::SessionStore::Session | 1 | class Session < ActiveRecord::SessionStore::Session |
2 | 2 | ||
3 | - def self.find_by_session_id(session_id) | ||
4 | - where(session_id: session_id).first | 3 | + # removed and redefined on super class |
4 | + def self.find_by_session_id session_id | ||
5 | + super | ||
5 | end | 6 | end |
6 | 7 | ||
7 | belongs_to :user | 8 | belongs_to :user |
lib/authenticated_system.rb
@@ -23,17 +23,6 @@ module AuthenticatedSystem | @@ -23,17 +23,6 @@ module AuthenticatedSystem | ||
23 | def current_user | 23 | def current_user |
24 | @current_user ||= begin | 24 | @current_user ||= begin |
25 | id = session[:user] | 25 | id = session[:user] |
26 | - | ||
27 | - session_id = cookies[:_noosfero_session] | ||
28 | - if id.blank? && session_id.present? | ||
29 | - Session.connection.clear_query_cache | ||
30 | - session_obj = Session.where(session_id: session_id).first | ||
31 | - if session_obj.present? | ||
32 | - session = session_obj.data | ||
33 | - id = session_obj.user_id | ||
34 | - end | ||
35 | - end | ||
36 | - | ||
37 | user = User.where(id: id).first if id | 26 | user = User.where(id: id).first if id |
38 | user.session = session if user | 27 | user.session = session if user |
39 | User.current = user | 28 | User.current = user |