diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-22 09:38:56 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-22 09:38:56 -0700 |
commit | 97f3c7387e22c7752310a6b9c74ddb9fd3a8eb2d (patch) | |
tree | 8d82297ab4129084f138cea08a62cb4c81189c67 /activerecord/lib | |
parent | 38734aff2005f1739ce7229db9d12363106f68c6 (diff) | |
download | rails-97f3c7387e22c7752310a6b9c74ddb9fd3a8eb2d.tar.gz rails-97f3c7387e22c7752310a6b9c74ddb9fd3a8eb2d.tar.bz2 rails-97f3c7387e22c7752310a6b9c74ddb9fd3a8eb2d.zip |
refactor to use instance methods and be kind to subclasses
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/session_store.rb | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/activerecord/lib/active_record/session_store.rb b/activerecord/lib/active_record/session_store.rb index b352f9529d..c6cf91c15d 100644 --- a/activerecord/lib/active_record/session_store.rb +++ b/activerecord/lib/active_record/session_store.rb @@ -265,22 +265,23 @@ module ActiveRecord def save return false unless loaded? marshaled_data = self.class.marshal(data) + connect = connection if @new_record @new_record = false - @@connection.update <<-end_sql, 'Create session' - INSERT INTO #{@@table_name} ( - #{@@connection.quote_column_name(@@session_id_column)}, - #{@@connection.quote_column_name(@@data_column)} ) + connect.update <<-end_sql, 'Create session' + INSERT INTO #{table_name} ( + #{connect.quote_column_name(session_id_column)}, + #{connect.quote_column_name(data_column)} ) VALUES ( - #{@@connection.quote(session_id)}, - #{@@connection.quote(marshaled_data)} ) + #{connect.quote(session_id)}, + #{connect.quote(marshaled_data)} ) end_sql else - @@connection.update <<-end_sql, 'Update session' - UPDATE #{@@table_name} - SET #{@@connection.quote_column_name(@@data_column)}=#{@@connection.quote(marshaled_data)} - WHERE #{@@connection.quote_column_name(@@session_id_column)}=#{@@connection.quote(session_id)} + connect.update <<-end_sql, 'Update session' + UPDATE #{table_name} + SET #{connect.quote_column_name(data_column)}=#{connect.quote(marshaled_data)} + WHERE #{connect.quote_column_name(session_id_column)}=#{connect.quote(session_id)} end_sql end end |