Rails行计数显示顺序

时间:2016-08-30 01:18:17

标签: ruby-on-rails rails-activerecord

H,

我正在尝试显示表格中的行数(按顺序,即第1,第2,第3 ......)。

Order.create(user_id: 1, created_on: '2016-09-29') - should display 1st
Order.create(user_id: 1, created_on: '2016-09-30') - should display 2nd
Order.create(user_id: 2, created_on: '2016-09-29') - should display 1st
Order.create(user_id: 3, created_on: '2016-09-28') - should display 1st
Order.create(user_id: 1, created_on: '2016-10-29') - should display 3rd

如何在rails中实现这一目标?

0 个答案:

没有答案