From 631707a572fe14f3bbea2779cc97fcc581048d62 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Sat, 7 Feb 2015 13:52:23 -0700 Subject: Push multi-parameter assignement into the types This allows us to remove `Type::Value#klass`, as it was only used for multi-parameter assignment to reach into the types internals. The relevant type objects now accept a hash in addition to their previous accepted arguments to `type_cast_from_user`. This required minor modifications to the tests, since previously they were relying on the fact that mulit-parameter assignement was reaching into the internals of time zone aware attributes. In reaility, changing those properties at runtime wouldn't change the accessor methods for all other forms of assignment. --- activerecord/lib/active_record/type/time.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activerecord/lib/active_record/type/time.rb') diff --git a/activerecord/lib/active_record/type/time.rb b/activerecord/lib/active_record/type/time.rb index cab1c7bf1e..930fb69da0 100644 --- a/activerecord/lib/active_record/type/time.rb +++ b/activerecord/lib/active_record/type/time.rb @@ -2,6 +2,9 @@ module ActiveRecord module Type class Time < Value # :nodoc: include TimeValue + include Helpers::AcceptsMultiparameterTime.new( + defaults: { 1 => 1970, 2 => 1, 3 => 1, 4 => 0, 5 => 0 } + ) def type :time -- cgit v1.2.3