[typo] Finding posts without a category
Trejkaz
trejkaz at trypticon.org
Sun Aug 21 20:17:57 EDT 2005
Quoting Kevin Ballard <kevin at sb.org>:
> On Aug 17, 2005, at 9:18 PM, Trejkaz wrote:
>
>> This is probably a silly question, but is there a way I can easily find all
>> posts without a category assigned? I want to make sure everything
>> has at least
>> one category, but at the moment it's a bit tedious to go hunting for them.
>
> I'd imagine the following would work:
>
> ./script/runner 'Article.find(:all, :include => [:categories]).reject
> { |a| a.has_categories? }.each { |a| p a }'
>
> Of course, I don't know for certain because all my articles have
> categories, so it prints nothing for me.
It works well. Thanks for that.
Do you think there's room for a "no category" item in the category list
sidebar?
It doesn't matter for my own site anymore, as I now have a category
where I put
everything that has no other category, but maybe it makes sense to put
there so
that people notice when they've forgotten to assign a category to a post.
TX
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
More information about the Typo-list
mailing list