A
A
Anton Ipatov2014-12-14 15:10:07
MongoDB
Anton Ipatov, 2014-12-14 15:10:07

How to select records added more than a week ago?

Now I select entries added no more than a week

scope :today, -> { where(:published_at.gt => 1.week.ago) }

And how to select records added more than a week ago?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Ipatov, 2014-12-14
@IpatovAnton

Found the answer mongo has two methods $gt (greater than) and $lt (less than)

scope :today, -> { where(:published_at.lt => 1.week.ago) }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question