8000 #at(time: <?>) returning nil · Issue #199 · palkan/logidze · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
#at(time: <?>) returning nil #199
@somazx

Description

@somazx

Nice work on this gem - I love how it uses triggers/stored procedures and json columns.

I am struggling with the at(time: 1.hours.ago) instance method not working as I expected.

object.at(time: 1.hour.ago) returns nil, but I've been making changes to the object multiple times in the past 8 hours.

I'm wondering if it isn't a timezone issue?

1.hour.ago is ActiveSupport::TimeWithZone instance with time zone set to MDT.

And here is the log_data for the record:

 created_at: Mon, 28 Jun 2021 16:13:41 MDT -06:00,
 updated_at: Thu, 08 Jul 2021 22:07:43 MDT -06:00,
 log_data:
  #<Logidze::History:0x000055a6cc488758
   @data=
    {"h"=>
      [{"c"=>
         {"id"=>168,
          "title"=>"Competeny with custom fields",
          "bad_text"=>"PfffF",
          "form_type"=>"competency",
          "good_text"=>"Cool",
          "company_id"=>nil,
          "created_at"=>"2021-06-28T22:13:41.342691",
          "deleted_at"=>nil,
          "updated_at"=>"2021-07-09T00:02:35.032324"},
        "v"=>1,
        "ts"=>1625814155032},
       {"c"=>{"bad_text"=>"No", "good_text"=>"Yes", "updated_at"=>"2021-07-09 00:05:10.996913"}, "v"=>2, "ts"=>1625789110997},
       {"c"=>{"title"=>"Competency with custom fields", "updated_at"=>"2021-07-09 00:07:47.454674"}, "v"=>3, "ts"=>1625789267455},
       {"c"=>{"title"=>"Ninjas!", "updated_at"=>"2021-07-09 00:11:00.010293"}, "v"=>4, "ts"=>1625789460010},
       {"c"=>{"title"=>"Foobar", "updated_at"=>"2021-07-09 00:58:50.865794"}, "v"=>5, "ts"=>1625792330866},
       {"c"=>{"updated_at"=>"2021-07-09 03:53:26.390638"}, "v"=>6, "ts"=>1625802806391},
       {"c"=>{"updated_at"=>"2021-07-09 04:07:43.097926"}, "v"=>7, "ts"=>1625803663098}],
     "v"=>7}>>

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0