Displaying data from multiple models in a single view

I’m new to Ruby on Rails and I’m working on a simple app that manages
serial numbers/product keys for software.

I have three models and database tables setup:

Categories
Products
Serials

I’ve setup a view that shows each category on its own page. On a
category page, I’d like to have listed all of the products that belong
to that category along with all of the serial numbers that belong to
each product.

While I’m able to properly list all the products, I have no clue how to
display a list of serials for each product.

I’ve added has_many() and belongs_to() in my models and setup foreign
keys in my database tables.

Any help would be appreciated. Thanks.

Here are some links that helped me…

http://www.devx.com/webdev/Article/31357/0/page/1
page 5 and the code download help explain

http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html?page=5
page 5 gets relational

Some other good tutorials are listed here…
http://ajax.phpmagazine.net/2005/11/top_12_ruby_on_rails_tutorials.html

The book “Agile Web D. with Rails” is worth investing in also.

DAN

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs