Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding tests for sessions and clearing up warnings

  • Loading branch information...
commit 1f8edb996b97da0df6ed0f0e0ceffef9d84119ce 1 parent b456877
@tenderlove tenderlove authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 activerecord/lib/active_record/session_store.rb
View
12 activerecord/lib/active_record/session_store.rb
@@ -62,7 +62,7 @@ class Session < ActiveRecord::Base
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 @@ def create_table!
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 @@ def drop_table!
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 @@ def self.find_by_session_id(*args)
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
Please sign in to comment.
Something went wrong with that request. Please try again.