method
update
v3.0.9 -
Show latest stable
- Class:
Object
update()public
PUT <%= route_url %>/1 PUT <%= route_url %>/1.xml
# File railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb, line 58
def update
@<% singular_table_name %> = <% orm_class.find(class_name, "params[:id]") %>
respond_to do |format|
if @<%= orm_instance.update_attributes("params[:#{singular_table_name}]") %>
format.html { redirect_to(@<% singular_table_name %>, :notice => '<%= human_name %> was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @<% orm_instance.errors %>, :status => :unprocessable_entity }
end Related methods
- Instance methods
- `
- acts_like?
- app
- as_json
- blank?
- bundler?
- controller
- copy_instance_variables_from
- create
- create_fixtures
- destroy
- duplicable?
- edit
- helper
- html_safe?
- index
- instance_values
- instance_variable_names
- new
- new_session
- presence
- present?
- rake
- reload!
- returning
- root_dir
- show
- to_param
- to_query
- try
- unescape
- update
- with_options