Last active
October 10, 2016 02:51
-
-
Save mkhairi/eee1bf67f4dbb51acc65db74ead87af9 to your computer and use it in GitHub Desktop.
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 characters
#respond remote true redirect | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment