table join

its my code to display list from two tables where

def list
      @books = Book.find(:all)
      @subjects = Subject.find(:all)
     @bookss=Book.find(:all, :joins=>:subject)
how can i write code in list.rhtml to display datas from two tables...
i,ve tried like this...

<% @books.each do |c|%>
<%= c.title%> #column from first table
<> #column from second table...

but ,it displays error..
"undefined method `name' for #<Book:0x4779224>" any help pls..

Use an association. if you;ve got

class Book
   belongs_to :subject

and then

<% @books.each do |c|%>
<%= c.title%>
<% end %>

You don't need the the :joins option (you may want to use :include)

Fred works ...thak you ....then if i need to select datas from two
tables using foreign key say for eg: like

"select table1.fieldname,table2.fieldname.... from table1 left join
table2 on " how can i write code for that???
thank u for your kind reply.