diff options
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract_adapter.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index eecf4faa5d..ff9de712bc 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -61,12 +61,30 @@ module ActiveRecord include MonitorMixin include ColumnDumper + SIMPLE_INT = /\A\d+\z/ + define_callbacks :checkout, :checkin attr_accessor :visitor, :pool attr_reader :schema_cache, :last_use, :in_use, :logger alias :in_use? :in_use + def self.type_cast_config_to_integer(config) + if config =~ SIMPLE_INT + config.to_i + else + config + end + end + + def self.type_cast_config_to_boolean(config) + if config == "false" + false + else + config + end + end + def initialize(connection, logger = nil, pool = nil) #:nodoc: super() @@ -171,14 +189,14 @@ module ActiveRecord false end - # Does this adapter support database extensions? As of this writing - # only postgresql does. + # Does this adapter support database extensions? As of this writing only + # postgresql does. def supports_extensions? false end - # A list of extensions, to be filled in by databases that - # support them (at the moment, postgresql). + # A list of extensions, to be filled in by adapters that support them. At + # the moment only postgresql does. def extensions [] end @@ -326,10 +344,6 @@ module ActiveRecord # override in derived class ActiveRecord::StatementInvalid.new(message) end - - def valid_types?(type) - true - end end end end |