From e781aa31fc52a7c696115302ef4d4e02bfd1533b Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Tue, 20 May 2014 09:15:22 -0700 Subject: Replace `type_cast` case statement with delegation All subclasses of column were now delegating `type_cast` to their injected type object. We can remove the overriding methods, and generalize it on the `Column` class itself. This also enabled us to remove several column classes completely, as they no longer had any meaningful behavior of their own. --- .../connection_adapters/mysql_adapter.rb | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'activerecord/lib/active_record/connection_adapters/mysql_adapter.rb') diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index fc27e1dd66..af5f24b08f 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -66,21 +66,6 @@ module ActiveRecord # * :sslcipher - Necessary to use MySQL with an SSL connection. # class MysqlAdapter < AbstractMysqlAdapter - - class Column < AbstractMysqlAdapter::Column #:nodoc: - def type_cast(value) - if encoded? - super - else - cast_type.type_cast(value) - end - end - - def adapter - MysqlAdapter - end - end - ADAPTER_NAME = 'MySQL' class StatementPool < ConnectionAdapters::StatementPool @@ -142,11 +127,6 @@ module ActiveRecord end end - def new_column(field, default, sql_type, null, collation, extra = "") # :nodoc: - cast_type = lookup_cast_type(sql_type) - Column.new(field, default, cast_type, sql_type, null, collation, strict_mode?, extra) - end - def error_number(exception) # :nodoc: exception.errno if exception.respond_to?(:errno) end -- cgit v1.2.3