# Begginer question: how to edit using options\_from\_collection

**URL:** <https://www.ruby-forum.com/t/begginer-question-how-to-edit-using-options-from-collection/136878>\
**Category:** Rails\
**Created:** [May 7, 2008, 3:30am UTC](https://www.ruby-forum.com/t/begginer-question-how-to-edit-using-options-from-collection/136878 "2008-05-07T03:30:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kanekcwu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/7c8e57/32.png) [@kanekcwu](https://www.ruby-forum.com/u/kanekcwu)\
**Post date:** [May 7, 2008, 3:30am UTC](https://www.ruby-forum.com/t/begginer-question-how-to-edit-using-options-from-collection/136878/1 "2008-05-07T03:30:36Z")

</div>

Hi,

I have been stuck on this problem for 2 hours and still have no idea how  
to do it. Basically I have a relationship between Workout and Exercise

Exercise has many Work out

anyway in my code at Workout.view the edit.html that was generated  
through scaffold I wrote this

\<% form\_for(@workout) do |f| %\>

**Exercise**  
 \<%= select\_tag "exercise", options\_from\_collection\_for\_select(Exercise.find\_all, "id", "name", @workout.exercise\_id) %\>

 \<%= f.submit "Update" %\> \<% end %\>

For some reason it does not update when I click it. I don’t have any  
errors but it just doesn’t update. Does anyone know why?

Any help would be apperciated. Thanks

Kane

---

<div class="post-metadata">

**Author:** ![kanekcwu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/7c8e57/32.png) [@kanekcwu](https://www.ruby-forum.com/u/kanekcwu)\
**Post date:** [May 7, 2008, 5:08pm UTC](https://www.ruby-forum.com/t/begginer-question-how-to-edit-using-options-from-collection/136878/2 "2008-05-07T17:08:33Z")

</div>

bump

---

<div class="post-metadata">

**Author:** ![kanekcwu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/7c8e57/32.png) [@kanekcwu](https://www.ruby-forum.com/u/kanekcwu)\
**Post date:** [May 7, 2008, 6:54pm UTC](https://www.ruby-forum.com/t/begginer-question-how-to-edit-using-options-from-collection/136878/3 "2008-05-07T18:54:11Z")

</div>

What doesn’t update when you click on what?

If I had to guess, I’d say that your workout record isn’t updating  
when you click on the update button because you’re using “select\_tag”  
instead of “f.select”, so your exercise information shows up in  
params[:exercise] instead of params[:workout][:exercise]. You’re  
probably saving your workout record based on params[:workout], so it’s  
not getting the exercise info.

-Kyle
