[Rails] Re: Added associations but don't see generated methods
In stead of the observer idea, how about switching to an option
containing the link-record creation/population with the caveat that
the join-table be checked for the existence of a join-record for the
current expense-record ID, offering to overwrite the existing link or
canceling the new-link request.
That sounds pretty simple. Any fans of this idea?
Best,
Richard
On Jul 18, 6:13 pm, RichardOnRails
<RichardDummyMailbox58...@USComputerGurus.com> wrote:
> Hey Guys,
>
> How about this idea.
> 1. We revert to vendor as the first arg to collection_select.
> 2. That populates params["expense"]["vendor"] with the selected
> vendor's ID
> 3. We create an observer on the Create button
> 4. In the observer, we create a new join record and populate it
> with:
> a. The new Expense record's ID
> b. The selected vendor's ID
> c. Save the the join record.
>
> Ideally, that's what collection_select would do for us if we could
> invoke it in just the right way.
>
> Any votes in favor of this idea?
>
> Best wishes,
> Richard
>
> On Jul 18, 5:46 pm, RichardOnRails
>
> <RichardDummyMailbox58...@USComputerGurus.com> wrote:
> > OK Guys,
>
> > I think I understand the problem now. We've got to populate the join-
> > table with the ID of the new Expanse record and the ID of the selected
> > Vendor record.
>
> > Heretofore, I thought using vendor instead of Fred's vendor_id was
> > cool because:
> > 1. It didn't crash the new Expense record
> > 2. It populated the Expense vendor field with the ID of the selected
> > vendor.
>
> > Only now do I see that our goal is to populate the join-table. My
> > idea of qualifying vendor_id as expenses_vendor/:vendor didn't fly.
> > But you guys sound like you've got enough experience in Rails to see
> > through this problem. I keeping my fingers crossed.
>
> > > Best wishes to you both,
> > > Richad
--
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