Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要找到过去 12 个月表的所有记录。
任何帮助,将不胜感激。
假设您有ModelName继承自的类ActiveRecord::Base:
ModelName
ActiveRecord::Base
ModelName.all(:conditions => ['created_at > ?', Time.now - 12.months])