Back

Rails 4 取消turbolinks ( remove turbolinks from Rails 4)

发布时间: 2013-11-17 11:12:00

turbolinks 的作用是为了加快js的加载。把它放到了cache中。   ( it's said that using turbolink makes your browser loading js/css faster) 

我觉得很不爽,很多时候都会使我的JS出现莫名其妙的问题。   ( but I don't like it since it makes me lots of wired problems )

有了angular, 我们要 turbolink干什么? 直接干掉! ( so lets remove it from our Rails 4 since we haveAngular already ~ :)) 

refer to : 参考文章:  this post

1. Remove the gem 'turbolinks' line from your Gemfile.

2. Remove the //= require turbolinks from your app/assets/javascripts/application.js.

3. In your application.html.erb (layout file), change the js declaration: 

 <%= javascript_include_tag "application", "data-turbolinks-track" => true %> to

 <%= javascript_include_tag "application" %>

That's it. Prost! :)

Back