我正在使用脚手架我创建了一个项目我没有更新它在 pgadmin 中的值但我也能够创建和销毁并且更新的代码是
@department = Department.find(params[:id])
respond_to do |format|
if @department.update_attributes(params[:departments])
flash[:notice] = 'Department was successfully updated.'
format.html { redirect_to(@department) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @department.errors, :status => :unprocessable_entity }
end
end