Repository navigation
In combination with turbolinks getting error #134
Description
Activity
I have the same problem +1
I have fixed the problem. I don't know if this is correct:
initialize: -> new MyApp.Routers.Posts Backbone.history.start() unless Backbone.History.started $(document).on "page:change", -> Backbone.history.stop() Backbone.history.start()Please correct me if I'm wrong. thanks
Reacted by DanTaikoI tried your code but seems not to be running.
Are you sure that "initialize: ->" code is correct?initialize: ->
new MyApp.Routers.Posts
Backbone.history.start() unless Backbone.History.started
$(document).on "page:change", ->
Backbone.history.stop()
Backbone.history.start()It's 3 years old
čt 25. 8. 2016 v 6:50 odesílatel Carlos Morales notifications@github.com
napsal:I tried your code but seems not to be running.
Are you sure that "initialize: ->" code is correct?initialize: ->
new MyApp.Routers.Posts
Backbone.history.start() unless Backbone.History.started
$(document).on "page:change", ->
Backbone.history.stop()
Backbone.history.start()—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#134 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABYDLfvcGnMZM4szmsTAwzIJQdrCduSoks5qjR8PgaJpZM4AUBDl
.I had the same problem.
The solution of @hyperrjas should be workable, unless turbolink is set.With 'turbolink' I got the following possible solution that works for me (enviroment: Rails v5.1.1, jQuery v3.2.1, Backbone 1.2.0):
initialize: -> new MyApp.Routers.Posts Backbone.history.start() unless Backbone.History.started $(document).on "turbolinks:click", -> Backbone.history.stop()Or even more simple one, depending of your need:
initialize: -> new MyApp.Routers.Posts Backbone.history.start() unless Backbone.History.startedI don't think it's a Backbone-rails bug, it lies in understanding of the Backbone.routing and Turbolink events.
Hope it will be helpfull to someone. ;-)
Reacted by andriy-baran
Backbone-rails isn't compatible with Turbolinks gem, which it will has to be since turbolinks gem going to be in Rails 4.0
When I load page and then click on some link which will be processed by turbolinks, getting error below
Uncaught Error: Backbone.history has already been started