Skip to content

Instantly share code, notes, and snippets.

@salgadobreno
Created March 25, 2011 01:19

Revisions

  1. salgadobreno created this gist Mar 25, 2011.
    21 changes: 21 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    #e is the Event.first
    #I just can't understand whats going on...
    #first date is Sat, 01 Jan
    #after saving it becomes Sun, 31 Dec
    #after re-retrieving the same record its Fri, 31 Dec
    #WHATS GOING ON HERE?!

    irb(main):088:0> date = Date.civil(01,01,01)
    => Sat, 01 Jan 0001
    irb(main):090:0> e.start_at = date
    => Sat, 01 Jan 0001
    irb(main):091:0> e.save
    => true
    irb(main):092:0> e.start_at
    => Sun, 31 Dec 0000 22:53:32 LMT -03:06
    irb(main):093:0> Event.first.start_at
    => Fri, 31 Dec 0000 22:53:32 LMT -03:06
    irb(main):094:0>
    irb(main):094:0> Event.first
    => #<Event id: 1, name: "e1", start_at: "0001-01-01 02:00:00", end_at: "0001-01-01 02:00:00", created_at: "2011-03-24 22
    :37:36", updated_at: "2011-03-25 00:49:52", description: nil, user_id: nil>