Ooooops, das stimmt, steht sogar im grauen Kästchen. Das hatte ich mir sogar mal
angestrichen: von Blindheit geschlagen.
Vielen Dank für den Hinweis
Michael Kastner
Sebastian Röbke schrieb:
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
--
------------------------------
galt.de Web :-) Services
Michael Kastner
Berliner Straße 3
D-65439 Flörsheim
Telefon +49 (0) 6145 / 938 581
Telefax +49 (0) 6145 / 938 582
E-Mail [EMAIL PROTECTED]
Homepage http://www.galt.de
------------------------------
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug