diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-21 15:34:43 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-21 16:36:28 -0700 |
commit | 1f8edb996b97da0df6ed0f0e0ceffef9d84119ce (patch) | |
tree | 2fd31599918ee1f12e99fbdbc2da6a8b1d154bae /activerecord/lib/active_record | |
parent | b456877cfb7e0cb0bab9ffd5674abd23caba0ab4 (diff) | |
download | rails-1f8edb996b97da0df6ed0f0e0ceffef9d84119ce.tar.gz rails-1f8edb996b97da0df6ed0f0e0ceffef9d84119ce.tar.bz2 rails-1f8edb996b97da0df6ed0f0e0ceffef9d84119ce.zip |
adding tests for sessions and clearing up warnings
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/session_store.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/session_store.rb b/activerecord/lib/active_record/session_store.rb index 7ea7fb5c51..0c2db4156b 100644 --- a/activerecord/lib/active_record/session_store.rb +++ b/activerecord/lib/active_record/session_store.rb @@ -62,7 +62,7 @@ module ActiveRecord class << self def data_column_size_limit - @data_column_size_limit ||= columns_hash[@@data_column_name].limit + @data_column_size_limit ||= columns_hash[data_column_name].limit end # Hook to set up sessid compatibility. @@ -83,8 +83,8 @@ module ActiveRecord connection.execute <<-end_sql CREATE TABLE #{table_name} ( id INTEGER PRIMARY KEY, - #{connection.quote_column_name('session_id')} TEXT UNIQUE, - #{connection.quote_column_name(@@data_column_name)} TEXT(255) + #{connection.quote_column_name(session_id_column)} TEXT UNIQUE, + #{connection.quote_column_name(data_column_name)} TEXT(255) ) end_sql end @@ -94,6 +94,10 @@ module ActiveRecord end private + def session_id_column + 'session_id' + end + # Compatibility with tables using sessid instead of session_id. def setup_sessid_compatibility! # Reset column info since it may be stale. @@ -106,6 +110,8 @@ module ActiveRecord define_method(:session_id) { sessid } define_method(:session_id=) { |session_id| self.sessid = session_id } else + class << self; remove_method :find_by_session_id; end + def self.find_by_session_id(session_id) find :first, :conditions => {:session_id=>session_id} end |