On 10 March 2016 at 11:26, John Sanderbeck <li...@ruby-forum.com> wrote:
> Colin Law wrote in post #1182080:
>> On 9 March 2016 at 23:19, John Sanderbeck <li...@ruby-forum.com> wrote:
>> Perhaps you had better tell us exactly what associations you have
>> setup, in terms of has_many, belongs_to has_many_many through etc.
>> Tell us what you have declared for each model.
>
> The associations are in the file attachments at the head of this post.
>
> I have
>
>   1. a training that has_many attendees and has_many organizations
> through attendees.
>   2. a organization that has many attendees and has_many trainings
> through attendees
>   3. a join table of attendees with a training_id, organization_id, and
> attendance_count
>
>   Looking though my code just now I noticed that I had an ID on the
> attendees join which I shouldn't have and did not have a unique index. I
> just fixed that however I don't believe that has anything to do with my
> problem.
>
>   I guess my issue is that I don't know the proper way to display the
> form to allow adding attendance to the training by displaying all the
> organizations with a text box beside the name to add the count for each
> organization.

With those relationships an organization does not have an
attendance_count, it has_many attendees and each attendee contains an
attendance_count. An organization has associated with it many counts,
not one.  So how can you have a box to enter an attendance_count for
an organization?

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLskgRWsQTN_nE_WCTySMTH%3DBwmkrb9%3DiSawCZDKBgsgfA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to