diff --git a/app/controllers/problems_controller.rb b/app/controllers/problems_controller.rb --- a/app/controllers/problems_controller.rb +++ b/app/controllers/problems_controller.rb @@ -15,7 +15,7 @@ :create, :quick_create, :do_manage, :do_import, - :update ], + ], :redirect_to => { :action => :index } def show @@ -71,14 +71,14 @@ def update @problem = Problem.find(params[:id]) @description = @problem.description - if @description == nil and params[:description][:body]!='' + if @description.nil? and params[:description][:body]!='' @description = Description.new(params[:description]) if !@description.save flash[:notice] = 'Error saving description' render :action => 'edit' and return end @problem.description = @description - elsif @description!=nil + elsif @description if !@description.update_attributes(params[:description]) flash[:notice] = 'Error saving description' render :action => 'edit' and return diff --git a/app/views/problems/edit.html.erb b/app/views/problems/edit.html.erb --- a/app/views/problems/edit.html.erb +++ b/app/views/problems/edit.html.erb @@ -1,6 +1,6 @@

Editing problem

-<%= form_tag({action: 'update', id: @problem},multipart: true) do %> +<%= form_for @problem,url:{action: 'update'},html: {multipart: true} do %> <%= render :partial => 'form' %> <%= submit_tag 'Edit' %> <% end %>