Recommendation for searching with regards to timestamp & foreign key attributes

Sorry guys, please replace "
new_blog_entries = Blog.status_name_does_not_equal_any([‘published’,
‘archived’])
"

with "
new_blog_entries = Blog.status_name_does_not_equal_all([‘published’,
‘archived’])
"

If you are using Rails 2.1 or greater, then named_scope would be very
useful.

In your Blog model for example, you can specify a recent named_scope
to return all entries less than 24 hours old.

named_scope :recent, :conditions => [ “created_at > ?”, Time.now -
24.hours ]

and maybe another one for unpublished entries

modify the conditions and include accordingly as I don’t know enough

about

your models

named_scope :unpublished, :include => :status, :conditions =>
“statuses.status != ‘published’”

In your controllers then, you can do something like

@new_unpublished_entries = Blog.unpublished.recent

bravo! I like the idea, Franz! Thank you :slight_smile: