Last active
October 10, 2016 02:51
-
-
Save mkhairi/eee1bf67f4dbb51acc65db74ead87af9 to your computer and use it in GitHub Desktop.
Revisions
-
mkhairi revised this gist
Oct 10, 2016 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ #respond remote true redirect def create @post = Post.new(post_params) respond_to do |format| @@ -12,4 +12,3 @@ end end end -
mkhairi revised this gist
Oct 10, 2016 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ ``` def create @post = Post.new(post_params) respond_to do |format| if @post.save @@ -10,4 +11,5 @@ format.json { render json: @post.errors, status: :unprocessable_entity } end end end ``` -
mkhairi created this gist
Oct 10, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ def create @post = Post.new(post_params) respond_to do |format| if @post.save format.js { redirect_to post_comments_path(@post), turbolinks: false} #or #redirect_to post_comments_path(@post), status: 303, turbolinks: false else format.html { render :new } format.json { render json: @post.errors, status: :unprocessable_entity } end end end