[Rails] Re: Getting belongs_to and has_many working: good plan?
> http://guides.rubyonrails.org/association_basics.html#the-has-and-bel...
This is an excellent reference. Much, much better than anything I
found with Google searches! Thank you very much.
Best wishes,
Richard
On Jul 12, 8:46 pm, Me <chabg...@gmail.com> wrote:
> 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-bel...
>
> On Jul 12, 7:24 pm, Marnen Laibow-Koser <li...@ruby-forum.com> 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
> > mar...@marnen.org
>
> > 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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home