I am using Rails 2.0.2 with mysql database I have two tables: book and author Table book has 3 columns: id, isbn, and title Table author has 3 columns: id, name, and age
In the models I have: class Book < ActiveRecord::Base belongs_to :author end class Author < ActiveRecord::Base has_many :books end I have author_id as the foreign key in the book's table The user will select 'age' from a list Then I want to display names of all authors with the selected age, and also the 'title' from book's table. In plain SQL, the query will be like this: SELECT name, title FROM author INNER JOIN book ON author.id = book.id WHERE age = "the selected age" How can I write this in Ruby? Thanks Cypray -- 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 rubyonrails-talk@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---