Hi,

Recently, I tried to migrate from mysql gem to mysql2 gem. One different 
behavior I noticed is the Time(only_time) column. For the saved object, the 
value is a Time object with date pointing to "2000-01-01" whereas for the 
new object, the value is a Time object with date pointing to current date. 
I didn't encounter this when worked with mysql gem(both the cases, it is 
current date).

Is there a way I can make the time object to be of the same date of new and 
saved objects?

Here is my output from racksh:

[1] pry(main)> s = Slot.first
=> #<Slot @values={:id=>342, :start=>2000-01-01 09:00:00 +0000, 
:finish=>2000-01-01 17:00:00 +0000}>
[2] pry(main)> s_new = Slot.new(start: "09:00:00")
=> #<Slot @values={:start=>2016-08-11 09:00:00 +0000}>
[3] pry(main)> s_new.start
=> 2016-08-11 09:00:00 +0000
[4] pry(main)> s.start
=> 2000-01-01 09:00:00 +0000

This is my migration:

Sequel.migration do
  create_table(:slots) do
    ...
    Time :start, only_time: true
    ...
  end
end

Thanks,
Satya

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" 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/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to