From 75de3cbb13b03da8d53460de2a33135269a0a379 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 25 Mar 2006 21:42:27 +0000 Subject: Fixed that MySQL enums should always be returned as strings (closes #3501) [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4028 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/CHANGELOG | 2 ++ activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | 1 + 2 files changed, 3 insertions(+) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index afceb51180..52c2e81fb1 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fixed that MySQL enums should always be returned as strings #3501 [DHH] + * Change has_many :through to use the :source option to specify the source association. :class_name is now ignored. [Rick Olson] class Connection < ActiveRecord::Base diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index 9e06c63181..881e22c476 100755 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -43,6 +43,7 @@ module ActiveRecord private def simplified_type(field_type) return :boolean if MysqlAdapter.emulate_booleans && field_type.downcase.index("tinyint(1)") + return :string if field_type =~ /enum/i super end end -- cgit v1.2.3