Forum: Ruby on Rails Sorting records from acts_as_taggable plugin

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Shane P. (Guest)
on 2006-06-03 01: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.

Thanks!
Vincent AE Scott (Guest)
on 2006-06-13 20:25
(Received via mailing list)
#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
This topic is locked and can not be replied to.