aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/column.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-05-20 07:51:33 -0700
committerSean Griffin <sean@thoughtbot.com>2014-05-20 08:12:28 -0700
commitac371655974aff8c7d09ab374fa2d3e9f1fa6f15 (patch)
tree8213d3911d9d98406ff42c9657b24421944beb25 /activerecord/lib/active_record/connection_adapters/column.rb
parentd17b05657153f4305e4112532c485239d49b77b8 (diff)
downloadrails-ac371655974aff8c7d09ab374fa2d3e9f1fa6f15.tar.gz
rails-ac371655974aff8c7d09ab374fa2d3e9f1fa6f15.tar.bz2
rails-ac371655974aff8c7d09ab374fa2d3e9f1fa6f15.zip
Delegate type_cast to injected type object in mysql
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/column.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/column.rb17
1 files changed, 2 insertions, 15 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/column.rb b/activerecord/lib/active_record/connection_adapters/column.rb
index 25a9cdafcf..11b2e728e1 100644
--- a/activerecord/lib/active_record/connection_adapters/column.rb
+++ b/activerecord/lib/active_record/connection_adapters/column.rb
@@ -132,6 +132,8 @@ module ActiveRecord
end
class << self
+ include Type::TimeValue
+
# Used to convert from BLOBs to Strings
def binary_to_string(value)
value
@@ -215,21 +217,6 @@ module ActiveRecord
end
end
- def new_time(year, mon, mday, hour, min, sec, microsec, offset = nil)
- # Treat 0000-00-00 00:00:00 as nil.
- return nil if year.nil? || (year == 0 && mon == 0 && mday == 0)
-
- if offset
- time = Time.utc(year, mon, mday, hour, min, sec, microsec) rescue nil
- return nil unless time
-
- time -= offset
- Base.default_timezone == :utc ? time : time.getlocal
- else
- Time.public_send(Base.default_timezone, year, mon, mday, hour, min, sec, microsec) rescue nil
- end
- end
-
def fast_string_to_date(string)
if string =~ Format::ISO_DATE
new_date $1.to_i, $2.to_i, $3.to_i