aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorZach <zmeyer@gmail.com>2016-05-10 11:34:12 -0500
committerZach <zmeyer@gmail.com>2016-05-10 11:34:12 -0500
commitbb53774a91f9bef963f56c019fa8bea12a0f3435 (patch)
tree36c0f55d21115aa03e25a3eda15afe6dbf819b21 /guides
parent6dec7645192bd89d81d47542255a346f93710830 (diff)
downloadrails-bb53774a91f9bef963f56c019fa8bea12a0f3435.tar.gz
rails-bb53774a91f9bef963f56c019fa8bea12a0f3435.tar.bz2
rails-bb53774a91f9bef963f56c019fa8bea12a0f3435.zip
Minor syntax change
While working on this very example recently, I found that Rails will throw POST errors if you leave an empty block in front the `format.js` when using either `remote: true` or vanilla JS/JQuery.
Diffstat (limited to 'guides')
-rw-r--r--guides/source/working_with_javascript_in_rails.md2
1 files changed, 1 insertions, 1 deletions
diff --git a/guides/source/working_with_javascript_in_rails.md b/guides/source/working_with_javascript_in_rails.md
index c58aee96db..c1dfcab6f3 100644
--- a/guides/source/working_with_javascript_in_rails.md
+++ b/guides/source/working_with_javascript_in_rails.md
@@ -328,7 +328,7 @@ this:
respond_to do |format|
if @user.save
format.html { redirect_to @user, notice: 'User was successfully created.' }
- format.js {}
+ format.js
format.json { render json: @user, status: :created, location: @user }
else
format.html { render action: "new" }