:allergy_ids is the foreign key for the join table.

When you make an association, "you instruct Rails to maintain Primary
Key­Foreign Key information between instances of the two models"
From:  jprince <notifications@github.com>
Reply-To:  kindrdfood/studmuffin
<reply+p-9979182-28c3819eea5db3387cb60937da1fcdc56935f137-6509642@reply.gith
ub.com>
Date:  Sunday, February 23, 2014 at 8:11 PM
To:  kindrdfood/studmuffin <studmuffin@noreply.github.com>
Cc:  Mike Maker <maker@kindrdfood.com>
Subject:  Re: [studmuffin] Added fields to the user database and views (#4)


In app/views/users/new.html.erb:
> -  </div>
> -  <div class='field'>
> -    <%= f.label :password %><br />
> -    <%= f.text_field :password %>
> -  </div>
> -  <div class='actions'>
> -    <%= f.submit %>
> -  </div>
> +  <form class = 'form-horizontal' role = 'form'>
> +    <div class='form-group'>
> +      <%= f.label :fullname %>
> +      <%= f.text_field :fullname, placeholder: 'Name' %>
> +    </div>
> +    <div class='form-group'>
> +      <%= f.label :allergy %>
> +      <%= f.select :allergy_ids, Allergy.all.collect {|x| [x.name, x.id]},
{}, :size => Allergy.count, :multiple => true %>
What is :allergy_ids? The migration added :allergy to user.

‹
Reply to this email directly or view it on GitHub
<https://github.com/kindrdfood/studmuffin/pull/4/files#r9979182> .