标签: ruby-on-rails-3 activerecord
假设我有一个包含三个日期字段的模型:
created_at
updated_at
xyz_at
如何查找xyz_at<所有记录? updated_at?
答案 0 :(得分:3)
records = YourModel.where('xyz_at < updated_at') for record in records puts record.updated_at, record.xyz_at end