Skip to content

Instantly share code, notes, and snippets.

Avatar

eddie.chen chenghung

  • Taiwan
  • Taipei City
View GitHub Profile
View gist:1c45ec95e2d7b49ad1a64fa2f9d77eff
POST /orders
{
id: 5,
state: 'payment-expected',
_links: {
self: {
method: 'GET',
href: '/orders/5',
}
View gist:a0596299542e062f943b
10 def get_sequence(name)
11 data = self.find_or_create_by id: name
12
13 data.with_lock do # could not get lock error here
14 data.sequence += 1
15 data.save!
16
17 data.sequence
18 end
19 end
You can’t perform that action at this time.