On 17 February 2011 15:42, rogi
<patrik.keller-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
wrote:> Hi there
>
> ../view/trainings:
> in my _form.html.erb I use a collection_select to get the id of a
> worker from Worker-table.
> <%= collection_select(:worker, :id, @workers, :id, :first_name,
> options ={:prompt => "Select a worker"}, :class
=>"worker") %></div>
>
> The collection select shows correct, but there will be no entry in the
> worker_id field of the new entry.
> If I use a text_field to pass the number it works:
> <%= f.label :worker_id %><br />
> <%= f.text_field :worker_id %>
Have a look in log/development.log in the case of the collection
select and see how it is passing the data to the controller. Compare
with the log using the text field and you should see the difference
and so what to correct in the controller action to pick the correct
data up from the form.
Colin
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
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.