its my code to display list from two tables where
books.subject_id=subjects.id...
def list
@subject= Subject.new
@books = Book.find(:all)
@subjects = Subject.find(:all)
@bookss=Book.find(:all, :joins=>:subject)
end
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
<%=c.name%> #column from second table...
but ,it displays error..
"undefined method `name' for #<Book:0x4779224>" any help pls..
yeah..it 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 table2.id=table1.table_id " how can i write code for that???
thank u for your kind reply.