I'm using PostgreSQL time data types. One column is an array. Both fields 
have the same issue.

My problem is that an attribute changes data type after the object is 
saved. From Time before being saved to ActiveRecord::Type::Time::Value 
after save. Reloading the object gives Time again.

Prior to Rails 5.0.2 the data type was changed on a standard column, but 
not on the time array column. It's good that it is consistent, but 
shouldn't the attribute return the same data type at all times?

g = GoodTime.new(one_time:"10:00", many_times:["15:30", "17:45"])
=> #<GoodTime id: nil, one_time: "2000-01-01 10:00:00", many_times: 
[2000-01-01 15:30:00 UTC, 2000-01-01 17:45:00 UTC]>
g.one_time.class
=> Time
g.many_times.first.class
=> Time
g.save
=> true
g.one_time.class
=> ActiveRecord::Type::Time::Value
g.many_times.first.class
=> ActiveRecord::Type::Time::Value
g.reload
=> #<GoodTime id: 6, one_time: "2000-01-01 10:00:00", many_times: 
[2000-01-01 15:30:00 UTC, 2000-01-01 17:45:00 UTC]>
irb(main):020:0> g.one_time.class
=> Time
irb(main):021:0> g.many_times.first.class
=> Time

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to