Permalink
Browse files

Fix bugs in update proposal api.

  • Loading branch information...
1 parent 597845a commit a597fd55016597cc83381a95cd5ef5f2eb8dd27d @guanxiaohua2k6 guanxiaohua2k6 committed Dec 13, 2011
Showing with 11 additions and 10 deletions.
  1. +10 −10 app/controllers/proposals_controller.rb
  2. +1 −0 public/javascripts/rest_apis/index.js
@@ -121,18 +121,18 @@ def update
if @proposal.update_attributes(params[:proposal])
@proposal.state = "init"
- if @proposal.save
- respond_to do |format|
- format.html { redirect_to(proposals_url) }
- format.json { render :json => @proposal.as_json, :location => @proposal }
- end
- else
- respond_to do |format|
- format.html { render :action => "new" }
- format.json { render :json => {:errors => @proposal.errors}.as_json }
- end
+ @proposal.save
+ respond_to do |format|
+ format.html { redirect_to(proposals_url) }
+ format.json { render :json => JSON.pretty_generate(@proposal.as_json) }
+ end
+ else
+ respond_to do |format|
+ format.html { render :action => "new" }
+ format.json { render :json => {:errors => @proposal.errors}.as_json }
end
end
+
end
def destroy
@@ -165,6 +165,7 @@ function do_click_exec_btn(btn) {
alert("Succeeded.");
},
error: function(data) {
+ $("#" + action + "_result_textarea").attr("rows", 1).val("");
alert("Error occurred!!!");
},
complete: function() {

0 comments on commit a597fd5

Please sign in to comment.