From 21c4b0942f4014c86117c27a452e68094a05d538 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Thu, 22 Jul 2010 14:57:42 -0300 Subject: [PATCH 1/4] Don't shadow outer local variables --- activesupport/lib/active_support/descendants_tracker.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/activesupport/lib/active_support/descendants_tracker.rb b/activesupport/lib/active_support/descendants_tracker.rb index 6cba84d79e..4d1cfacc95 100644 --- a/activesupport/lib/active_support/descendants_tracker.rb +++ b/activesupport/lib/active_support/descendants_tracker.rb @@ -11,9 +11,9 @@ module ActiveSupport end def self.descendants(klass) - @@direct_descendants[klass].inject([]) do |descendants, klass| - descendants << klass - descendants.concat klass.descendants + @@direct_descendants[klass].inject([]) do |descendants, _klass| + descendants << _klass + descendants.concat _klass.descendants end end @@ -40,4 +40,4 @@ module ActiveSupport DescendantsTracker.descendants(self) end end -end \ No newline at end of file +end From 1b8cd5fb53d0414b2dbbcaf0bc4f8851b8550e34 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Thu, 22 Jul 2010 12:07:16 -0300 Subject: [PATCH 2/4] MySQL can't index a TEXT column --- activerecord/lib/active_record/session_store.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/session_store.rb b/activerecord/lib/active_record/session_store.rb index c6cf91c15d..bb472f7ab6 100644 --- a/activerecord/lib/active_record/session_store.rb +++ b/activerecord/lib/active_record/session_store.rb @@ -83,7 +83,7 @@ module ActiveRecord connection.execute <<-end_sql CREATE TABLE #{table_name} ( id INTEGER PRIMARY KEY, - #{connection.quote_column_name(session_id_column)} TEXT UNIQUE, + #{connection.quote_column_name(session_id_column)} VARCHAR(255) UNIQUE, #{connection.quote_column_name(data_column_name)} TEXT(255) ) end_sql @@ -220,7 +220,7 @@ module ActiveRecord connection.execute <<-end_sql CREATE TABLE #{table_name} ( id INTEGER PRIMARY KEY, - #{connection.quote_column_name(session_id_column)} TEXT UNIQUE, + #{connection.quote_column_name(session_id_column)} VARCHAR(255) UNIQUE, #{connection.quote_column_name(data_column)} TEXT ) end_sql From 7113f207c34e41ffcbbd0b3570f3fe41bbfbbcaf Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Thu, 22 Jul 2010 12:08:37 -0300 Subject: [PATCH 3/4] This is a VARCHAR not a TEXT --- activerecord/lib/active_record/session_store.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/session_store.rb b/activerecord/lib/active_record/session_store.rb index bb472f7ab6..bd976acdbb 100644 --- a/activerecord/lib/active_record/session_store.rb +++ b/activerecord/lib/active_record/session_store.rb @@ -84,7 +84,7 @@ module ActiveRecord CREATE TABLE #{table_name} ( id INTEGER PRIMARY KEY, #{connection.quote_column_name(session_id_column)} VARCHAR(255) UNIQUE, - #{connection.quote_column_name(data_column_name)} TEXT(255) + #{connection.quote_column_name(data_column_name)} VARCHAR(255) ) end_sql end From 24f303b677e4a8f0ecf8c335d95c63c3f7f1bdcc Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Thu, 22 Jul 2010 13:00:29 -0300 Subject: [PATCH 4/4] Makes current adapter decide the syntax of PRIMARY KEY column definition --- activerecord/lib/active_record/session_store.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/session_store.rb b/activerecord/lib/active_record/session_store.rb index bd976acdbb..365fcd6222 100644 --- a/activerecord/lib/active_record/session_store.rb +++ b/activerecord/lib/active_record/session_store.rb @@ -82,7 +82,7 @@ module ActiveRecord def create_table! connection.execute <<-end_sql CREATE TABLE #{table_name} ( - id INTEGER PRIMARY KEY, + id #{connection.type_to_sql(:primary_key)}, #{connection.quote_column_name(session_id_column)} VARCHAR(255) UNIQUE, #{connection.quote_column_name(data_column_name)} VARCHAR(255) ) @@ -219,7 +219,7 @@ module ActiveRecord def create_table! connection.execute <<-end_sql CREATE TABLE #{table_name} ( - id INTEGER PRIMARY KEY, + id #{connection.type_to_sql(:primary_key)}, #{connection.quote_column_name(session_id_column)} VARCHAR(255) UNIQUE, #{connection.quote_column_name(data_column)} TEXT )