简体   繁体   中英

Find record of last 12 month in rails 2.3.8

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM