Sha256: cd0fe65ce6b041cb56fbb1d249e94acf884bccdcaaf352304ac2e70a0775ba2a
Contents?: true
Size: 908 Bytes
Versions: 2
Compression:
Stored size: 908 Bytes
Contents
function initialize(complete) { // Configure Backbone to talk with Rails Backbone.ajax = function() { Backbone.$.ajaxSetup.call(Backbone.$, { beforeSend: function(jqXHR){ var token = $("meta[name='csrf-token']").attr('content'); jqXHR.setRequestHeader('X-CSRF-Token', token); } }); return Backbone.$.ajax.apply(Backbone.$, arguments); }; $(function() { Backbone.history.start({ pushState: false, root: '/', silent: true }); // RootView may use link or url helpers which // depend on Backbone history being setup // so need to wait to loadUrl() (which will) // actually execute the route <%= js_app_name %>.RootView.getInstance(document.body); complete(function() { Backbone.history.loadUrl(); }); }); } initialize(function(next) { // things to do when your application is loaded! next(); });
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
thorax-rails-1.0.0 | lib/generators/thorax/install/templates/init.js |
thorax-rails-0.1.8 | lib/generators/thorax/install/templates/init.js |