Records Created Yesterday in Rails
What is the activerecord call for finding all User created_at is yesterday?
To find all User records with a created_at
timestamp of yesterday using ActiveRecord in Ruby on Rails, you can use the following code:
|
|
This code first creates a range representing yesterday’s date from the beginning of the day to the end of the day. Then, it queries the User
model using the where
method to filter the records based on the created_at
timestamp within the specified range. The result is an ActiveRecord relation containing all User records created yesterday.