Simon Macneall wrote: > Wouldn't it be something like the following: > > suess_chapter_three = Chapter.find(:all, :include=>:book, :conditions => > ['books.auther like "suess" and chapters.chapter = 3']) > > Simon
Thanks for the response Simon -- I think my example didn't fully capture what I am trying to do :) I want to select from a collection or list of items. I can't use 'books.author like' because there is no criteria that ties them all together. A better example would be: User is presented with a list of checkboxes (let's say, book names) in a form. He checks several of these checkboxes. The form gets submitted and returns all of the chapters 3 from the selected books. For example say the user selects: Fox in Sock by Dr Seuss War and Peace by Leo Tolstoy The Godfather by Mario Puzo The form passes the ids of these selections (let's say, [1000, 1001, 1002]) to the controller, which then calls a query on these selected plates: selected_books = params[:selected_books] Chapter.find(:all, :include=>:book, :conditions => 'chapter.book_id = book.id and book.id in books and chapters.chapter=3' ) Is there a way to do that statement? "in books" is obviously not a valid command... Thanks! A -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

