I need to find all records of table of last 12 month.
Any Help would be appreciated.
假设您有从ActiveRecord::Base
继承的ModelName
类:
ModelName.all(:conditions => ['created_at > ?', Time.now - 12.months])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.