[Ruby] How to get / select only records that are more than XX years old

How to get / select only records that have been created for more than 〇〇

Conclusion

Record.where('created_at < ?', 1.minute.ago).order(created_at: :desc)

The important thing is ('created_at <?', 〇〇)

Just enter your favorite conditions in 〇〇.

1 hour ago 1.hour.ago One day ago 1.day.ago

Question

Are there any methods or better practices that don't use quotation marks?

The information was unexpectedly difficult to find. .. ..

Recommended Posts

[Ruby] How to get / select only records that are more than XX years old
How to get date data in Ruby
How to get the date from the JavaScript Date type that C # developers are addicted to
How to get only articles and transactions that you commented or messaged [includes]
How to write code that thinks object-oriented Ruby
Rails / Ruby: How to get HTML text for Mail
[Ruby] How to get the tens place and the ones place