Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix bugs in update proposal api.

  • Loading branch information...
commit a597fd55016597cc83381a95cd5ef5f2eb8dd27d 1 parent 597845a
@guanxiaohua2k6 guanxiaohua2k6 authored
View
20 app/controllers/proposals_controller.rb
@@ -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
View
1  public/javascripts/rest_apis/index.js
@@ -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() {
Please sign in to comment.
Something went wrong with that request. Please try again.