Hi everyone,

I'm trying to update attributes in a collection passed to form_tag.
However my syntax for extracting values from the params hash results
in this exception:

undefined method `keys' for ["Vanilla", "Rose", "Cranberry"]:Array

So it appears I am trying to call keys on an array of "flavor"
attribute values, rather than extracting "Candle" object id keys from
the params hash. I have included the code from the view and controller
below.

Thanks for taking the time to read this. I appreciate any specific
suggestions, as well as any resources that explain the intricacies of
params.

Thank You!
Supraja

----
edit_all.html.erb:
<% form_tag(:action => "update_candle_line") do %>
  <% for @candle in @candles %>
    <%= text_field_tag("candle[]", @candle.flavor) %>
  <% end %>

  <%= submit_tag "Update" %>
<% end %>

----
edit_all_controller.rb:
def update_candle_line
    Candle.update(params[:candle].keys, params[:candle].values)
    redirect_to_index("Flavors updated!") # private method of
controller
 end

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to