On Sun, Dec 21, 2008 at 2:24 PM, Franz Strebel <[email protected]>wrote:
> > On Sun, Dec 21, 2008 at 7:34 PM, Patrick Doyle <[email protected]> wrote: > > Consider this: > > class Document > > has_many :revisions > > end > > class Revision > > belongs_to :document > > end > > Suppose I wanted to query all records in my revisions table, but I wanted > to > > order the results by document.number. What sort of conditions would I > have > > Specify the :order param in your find, à la :order => 'documents.number > ASC' > > I can't figure out how to make that work -- the revisions table does not have a column named "documents". It does have a "document_id" field, which is associated with a specific record in the documents table. I'm trying to figure out how I can query the "revisions" table, but sort the results based on data stored in the associated record in the "documents" table. --wpd --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

