Permalink
Browse files

r2837@asus: jeremy | 2005-07-05 00:34:31 -0700

 Don't restrict sessid compat. check to a single run.  Reset cached column info before checking in case it's stale (may happen if you change table_name).  Make the test a private class method.


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1693 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent ed12b0c commit d80d9a52bdc8b6ddf3b1ec846ddafd96d4ab3e8c @jeremy jeremy committed Jul 5, 2005
Showing with 19 additions and 20 deletions.
  1. +19 −20 actionpack/lib/action_controller/session/active_record_store.rb
@@ -46,26 +46,6 @@ def find_by_session_id(session_id)
find_by_session_id(session_id)
end
- # Compatibility with tables using sessid instead of session_id.
- def setup_sessid_compatibility!
- if !@sessid_compatibility_checked
- if columns_hash['sessid']
- def self.find_by_session_id(*args)
- find_by_sessid(*args)
- end
-
- alias_method :session_id, :sessid
- define_method(:session_id) { sessid }
- define_method(:session_id=) { |session_id| self.sessid = session_id }
- else
- def self.find_by_session_id(session_id)
- find :first, :conditions => ["session_id #{attribute_condition(session_id)}", session_id]
- end
- end
- @sessid_compatibility_checked = true
- end
- end
-
def marshal(data) Base64.encode64(Marshal.dump(data)) end
def unmarshal(data) Marshal.load(Base64.decode64(data)) end
def fingerprint(data) Digest::MD5.hexdigest(data) end
@@ -83,6 +63,25 @@ def create_table!
def drop_table!
connection.execute "DROP TABLE #{table_name}"
end
+
+ private
+ # Compatibility with tables using sessid instead of session_id.
+ def setup_sessid_compatibility!
+ # Reset column info since it may be stale.
+ reset_column_information
+ if columns_hash['sessid']
+ def self.find_by_session_id(*args)
+ find_by_sessid(*args)
+ end
+
+ define_method(:session_id) { sessid }
+ define_method(:session_id=) { |session_id| self.sessid = session_id }
+ else
+ def self.find_by_session_id(session_id)
+ find :first, :conditions => ["session_id #{attribute_condition(session_id)}", session_id]
+ end
+ end
+ end
end
# Lazy-unmarshal session state. Take a fingerprint so we can detect

0 comments on commit d80d9a5

Please sign in to comment.