Need help on Many to Many Relationships

Hi,
Does anyone know where I can find a full step by step tutorial on Many
to Many Relationships with Rails or can describe the steps in
inserting data into the join tables, displaying the connections, etc…

  • I don’t only need the model, but all the steps that you would use in
    the MVC architecture to make it work.

I am a new to Rails and I cannot find a complete tutorial on all the
steps needed to make this work probably. I have tried a number of
different things, but a lot of the tutorials online are from 2 years
ago and a lot has changed since then.

What I am trying to do is a CRUD system that works with Many to Many
relationships.

Example:
There will be 2 objects - books and authors
authors has many books
books has many authors (say more then 1 author wrote the book)

I then want to display a list of books and one of the fields I will be
pulling from the database is the authors associated with the books.

Then the same with authors.

I want to be able to insert, update, edit, delete from the ruby on
rails application, not manually from the Mysql database.

Thank you

On Sat, Sep 12, 2009 at 6:07 PM, MS999 [email protected] wrote:

Hi,
Does anyone know where I can find a full step by step tutorial on Many
to Many Relationships with Rails or can describe the steps in
inserting data into the join tables, displaying the connections, etc…

I always use an actual join model and :through.

The Many-to-many section on this page explains how it works:


Greg D.
http://destiney.com/

I have given the details @

http://www.ruby-forum.com/topic/191527

try and let me know

Open Source Craigslist in
Rails

Hi
Read these
http://guides.rubyonrails.org/association_basics.html#the-has-and-belongs-to-many-association

http://guides.rubyonrails.org/association_basics.html#the-has-many-through-association

http://guides.rubyonrails.org/association_basics.html#choosing-between-has-many-through-and-has-and-belongs-to-many

Sijo

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