Skip to content

Commit

Permalink
739588-Made the systems update call raise the error message the corre…
Browse files Browse the repository at this point in the history
…ct way
  • Loading branch information
parthaa committed Oct 12, 2011
1 parent c9018f7 commit 022b7af
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/app/controllers/systems_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,22 +183,15 @@ def edit

def update
begin
unless @system.update_attributes(params[:system])
errors @system.errors
respond_to do |format|
format.html { render :partial => "layouts/notification", :status => :bad_request, :content_type => 'text/html' and return}
format.js { render :partial => "layouts/notification", :status => :bad_request, :content_type => 'text/html' and return}
end
end
@system.update_attributes!(params[:system])
notice _("System updated.")

respond_to do |format|
format.html { render :text=>params[:system].first[1] }
format.js
end

rescue Exception => e
errors @system.errors
rescue Exception => error
errors error.to_s, {:persist => false}
respond_to do |format|
format.html { render :partial => "layouts/notification", :status => :bad_request, :content_type => 'text/html' and return}
format.js { render :partial => "layouts/notification", :status => :bad_request, :content_type => 'text/html' and return}
Expand Down

0 comments on commit 022b7af

Please sign in to comment.