Hallo Michael!
Michael Kastner wrote:
Kann ich mir diesen Code auch den Form-Helpern generieren?
Ja, das geht!
Das Vorgehen ist z.B. im Prag-Buch "Agile Web Development with Rails"
(2nd Ed) auf Seite 498 beschrieben.
Hier ein kleiner Auszug.
View:
<% form_tag do %>
<% for @product in @products %>
<%= text_field("product[]", 'image_url') %><br />
<% end %>
<%= submit_tag %>
<% end %>
"When the form is submitted to the controller, params[:product] will be
a hash of hashes, where each key is the id of a model object and the
corresponding value are the values from the form for that object."
Controller:
Product.update(params[:product].keys, params[:product].values)
Viele Grüße,
Sebastian
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug