Permalink
Browse files

backport type_cast_config_to_xxx adapter helpers from AR-4.0

  • Loading branch information...
kares committed Apr 4, 2013
1 parent 8090b51 commit 3d551a69f4cc588034343a137ca291639a0765ed
Showing with 13 additions and 1 deletion.
  1. +13 −1 lib/arjdbc/jdbc/adapter.rb
View
@@ -19,7 +19,7 @@ class JdbcAdapter < AbstractAdapter
extend ShadowCoreMethods
include CompatibilityMethods if CompatibilityMethods.needed?(self)
include JdbcConnectionPoolCallbacks if JdbcConnectionPoolCallbacks.needed?
-
+
attr_reader :config
def initialize(connection, logger, config)
@@ -465,7 +465,19 @@ def self.insert?(sql)
def self.update?(sql)
! select?(sql) && ! insert?(sql)
end
+
+ unless defined? AbstractAdapter.type_cast_config_to_integer
+
+ def self.type_cast_config_to_integer(config)
+ config =~ /\A\d+\z/ ? config.to_i : config
+ end
+ def self.type_cast_config_to_boolean(config)
+ config == "false" ? false : config
+ end
+
+ end
+
end
end
end

0 comments on commit 3d551a6

Please sign in to comment.