I have one really annoying problem - I hope you can give me some
advice...
1) I have a model "Article". Article has among other fields
created_at, published_at and publish_date field.
I want the list of "published" articles if the publish_date is <= then
current time/date.
Note that scopes defined with scope will be evaluated when they are defined, rather than when they are used. For example, the following would be incorrect:
The example above would be ‘frozen’ to the Time.now value when the Post class was defined, and so the resultant SQL query would always be the same. The correct way to do this would be via a lambda, which will re-evaluate the scope each time it is called: