ror开发的时候习惯使用sqlite数据库,使用find方法随机读取N条记录的示例:

 

def index
@items
= Item.find(:all,:limit => 6,:order => 'random(id)')
end

 

相关文章:

  • 2021-07-09
  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
  • 2022-02-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-08
  • 2021-06-16
  • 2022-01-05
  • 2022-12-23
相关资源
相似解决方案