I was tracking down an issue with Devise where gmtime was being called on a
DateTime value to construct a remember_me cookie. Thinking that I should
always be getting a DateTime back from the DB I constructed a solution. But
then in exploring further in the Rails console I discovered that I'm
typically getting a Time object. So, really two issues, why I am getting a
Time object in the console and why I also could get a DateTime in some
cases? Any ideas? Here's some console output:
>> Sequel.version
=> "3.30.0"
>> Sequel.datetime_class
=> DateTime
>> User.db.class.adapter_scheme
=> :mysql2
>> User.db_schema[:created_at]
=> {:type=>:datetime, :ruby_default=>nil, :db_type=>"datetime",
:primary_key=>false, :default=>nil, :allow_null=>true}
>> User[52].created_at
=> Thu Feb 02 15:09:59 -0800 2012
>> User[52].created_at.class
=> Time
>> User[52].remember_created_at
=> Tue Jul 31 12:55:27 -0700 2012
>> User[52].remember_created_at.class
=> Time
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sequel-talk/-/IIcK_D9X-jEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.