Skip to content

Instantly share code, notes, and snippets.

@gregblake
Created May 1, 2018 12:45
Show Gist options
  • Select an option

  • Save gregblake/cd8b9af4b924c528a11eeee03c724424 to your computer and use it in GitHub Desktop.

Select an option

Save gregblake/cd8b9af4b924c528a11eeee03c724424 to your computer and use it in GitHub Desktop.
Rails console for bookmarks race condition
irb(main):006:0> room = ConnectRoom.last
=> #<ConnectRoom id: 9974, name: "820am", jid: nil, created_at: "2018-05-01 12:20:10", updated_at: "2018-05-01 12:20:10", created_by_id: 31995, updated_by_id: nil, private: true, archived: false, corporate_event_id: nil, short_name: nil, connect_updated_at: "2018-05-01 12:20:10", group_conversation: false>
irb(main):007:0> room.connect_bookmarks.count
=> 1
irb(main):008:0> bookmark = room.connect_bookmarks.first
=> #<ConnectBookmark id: 2296652, user_id: 31995, bookmarkable_id: 9974, bookmarkable_type: "ConnectRoom", section: "rooms", created_at: "2018-05-01 12:20:10", updated_at: "2018-05-01 12:20:10", position: 1>
irb(main):009:0> room.created_at == bookmark.created_at
=> true
irb(main):010:0> bookmark.created_at
=> Tue, 01 May 2018 08:20:10 EDT -04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment