This is a better place to start, ruby on rails guide.  Basically all
you need is a foreign key pointing both directions in the join table.

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

On Jul 12, 7:24 pm, Marnen Laibow-Koser <[email protected]> wrote:
> RichardOnRails wrote:
> > I just added these linkage statements to my Expense and Vendor models,
> > respectively.
>
> Which?  You neglected to say. 
>
> > 
> > I found a "HOWTO: Beginning Relationships"
> > webpage (http://www.railsforum.com/viewtopic.php?id=265).
>
> Why are you following tutorials from 2006, before Rails 1.0 even
> existed?
>
> And what have you been doing all this time?  You've been posting on this
> list for a long time; have you really never looked at associations
> before?
>
> > 
> > That leads me to think that I need to:
> > 1. Create migration Add_Vendor_ID_to_Expense and then add column
> > vendor_id of type integer, or something like that.
> > 2. Create migration Add_Expense_ID_to_Vendor and then add column
> > expense_id of type integer, or something like that.
>
> You don't need both. 
>
> > 3. Create migration Create_Expense_Vendor_Table and then add
> > expense_id and vendor_id columns.
>
> You may not need this at all. 
>
> And it should all be in one migration class if it represents one
> conceptual change. 
>
> > 
> > Then I can rake db:migrate.
>
> Right. 
>
> > 
> > Is that a sensible start?
> > 
> > Thanks in advance,
> > Richard
>
> Best,
> -- 
> Marnen Laibow-Koserhttp://www.marnen.org
> [email protected]
>
> Sent from my iPhone
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to