method
update
v1.0.0 -
Show latest stable
- Class:
ActiveRecord::Base
update(id, attributes)public
Finds the record from the passed id, instantly saves it with the passed attributes (if the validation permits it), and returns it. If the save fails under validations, the unsaved object is still returned.
1Note
collection update
in the FirmsController
@firm.people.update(params[:people].keys,params[:people].values)
in the View
==== <% form_for(@firm) do |f| %> <%= f.error_messages %> <%= f.text_field :name %> <%@firm.people.each do |person|%> <%fields_for "people[]", person do |pf|%> <%= pf.text_field :name %> <%end%> <%= f.submit "Save" %> <%end%>