Sorting records from acts_as_taggable plugin


#1

I am using the acts_as_taggable plugin, which works rather nicely by the
way. My question is this: When using find_tagged_with, how do I sort the
resultant data? It is currently sorting based on the “id” of the record.
For instance, I have posts, with tags. If I want to find all posts
tagged with “RubyOnRails” it displays them, but not in chronological
order, they are displayed based on their id’s. I presume this wouldn’t
normally be a problem, but I am populating my posts table in the
database and the id’s aren’t in chronological order. I would like to
sort the results of find_tagged_with by the created_on field.

Thanks!


#2

#if shane.pinnell /* Jun 02, 11:09 */

I am using the acts_as_taggable plugin, which works rather nicely by the
way. My question is this: When using find_tagged_with, how do I sort the
resultant data? It is currently sorting based on the “id” of the record.
For instance, I have posts, with tags. If I want to find all posts
tagged with “RubyOnRails” it displays them, but not in chronological
order, they are displayed based on their id’s. I presume this wouldn’t
normally be a problem, but I am populating my posts table in the
database and the id’s aren’t in chronological order. I would like to
sort the results of find_tagged_with by the created_on field.
#endif /* removed_email_address@domain.invalid */

have a look at this:
http://dev.rubyonrails.org/ticket/3928

Basically, find_tagged_with accepts an options paramater where you can
define what :order gets passed to the actual find call.

I Only just spotted this today, and have been pulling my hair out over
:from, time for a post methinks.


keys: http://codex.net/gpg.asc

If voting changed anything, they’d make it illegal.
– Emma Goldman