I am delighted with turbolinks3 (it allows you to display only partial and not reboot the whole body) You can learn more about it from here: https://github.com/rails/turbolinks/blob/master/CHANGELOG.md It's awesome, but me problem: In browsers that do not support pushState (ie8 / 9 example), I do not know how to control the behavior. This gives me this error in IE8:
Could not set the innerHTML property. Invalid target element for this operation.
My controller code:
def create @post = Post.find(params[:post_id]) if @post.comments.create(comment_params) render '_comment', change: [:comments, :super_test], layout: false, :locals => { comment: @post.comments.last } else render json:'error' end end
A βsolutionβ could be:
redirect_to @post, change: [:comments, :super_test]
But then the problem is that it responds with a lot of data that I do not need! (and response time is longer). So again I want to find another solution.
How can I solve this problem? I thought of 2 solutions: 1) Use history.js / modernizr for polyfill pushState in older browsers
2) Find a way to check if the turbolinks / pjax request is running or not ... and use conditional rendering or redirect_to
- But I do not know how I can do this because turbolinks does not send a specific header, for example jquery-pjax
Any suggestions? I really appreciate that!
PS: Please do not offer me the spine / angular / ember / to respond, I already know them (the spine), but I want to try turbolinks.
source share