Forum: Ruby on Rails create a report page with 3 tables involved?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
SIX-S (Guest)
on 2006-05-05 22:07
(Received via mailing list)
I am learning Radrails and want to tie the web project all together by
displaying 3 tables linked together.
I want to select one  item from the main table, and then link to the
other two tables. they will be linked by the key of the first table.
It seems that I should create a rhtml in a main table or should I just
copy the list.rhtml created by the generator scaffold?
I might not make any sense, but I hope I do
Brian H. (Guest)
on 2006-05-05 22:22
(Received via mailing list)
1. Radrails is a product, not a programming language or framework.

2. controller should get your results

    @table1 = Table1.find(:all)
   @table2 = Table2.find(:all)
   @table3 = Table3.find(:all)

3. your rhtml view should then display them in tablular form using
HTML tags.
    <% @table1.each do |t| %>
        <td><%=t.first_name %></td>
        <td><%=t.last_name %></td>
    <% end %>

Rails is just like any other scripting language when it comes to the
parts... you have an object and you display it's data using the <%= %>
syntax simliar to ASP and JSP.

If none of this makes sense, you need to stop what you're doing and get
book, preferably the Agile Web D. with Rails book.

Hope that helps... good luck!
This topic is locked and can not be replied to.