LoginSignup
11
12

More than 5 years have passed since last update.

Rails 4.2 で turbolinks 無効にして初期生成

Last updated at Posted at 2015-01-15

4.2 リリースノート


--skip-turbolinks

Rails 4.2 ではアプリ初期生成を行う rails new に turbolinks を無効にするオプションが追加されている。

$ rails new myapp --skip-turbolinks

これによる生成ソースの差分は以下 (rails 4.2.0)

diff --git a/Gemfile b/Gemfile
index b43fd2f..14b4fb0 100644
--- a/Gemfile
+++ b/Gemfile
@@ -16,8 +16,6 @@ gem 'coffee-rails', '~> 4.1.0'

 # Use jquery as the JavaScript library
 gem 'jquery-rails'
-# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
-gem 'turbolinks'
 # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
 gem 'jbuilder', '~> 2.0'
 # bundle exec rake doc:rails generates the API under doc/api.
diff --git a/Gemfile.lock b/Gemfile.lock
index 84d3715..969c088 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -133,8 +133,6 @@ GEM
     thor (0.19.1)
     thread_safe (0.3.4)
     tilt (1.4.1)
-    turbolinks (2.5.3)
-      coffee-rails
     tzinfo (1.2.2)
       thread_safe (~> 0.1)
     uglifier (2.7.0)
@@ -159,6 +157,5 @@ DEPENDENCIES
   sdoc (~> 0.4.0)
   spring
   sqlite3
-  turbolinks
   uglifier (>= 1.3.0)
   web-console (~> 2.0)
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index 4a2ae1d..3e5bd21 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -12,5 +12,4 @@
 //
 //= require jquery
 //= require jquery_ujs
-//= require turbolinks
 //= require_tree .
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 3100df2..096256c 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -2,8 +2,8 @@
 <html>
 <head>
   <title>Myapp</title>
-  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
-  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
+  <%= stylesheet_link_tag    'application', media: 'all' %>
+  <%= javascript_include_tag 'application' %>
   <%= csrf_meta_tags %>
 </head>
 <body>

後から無効化する場合には上記の差分箇所を更新すればよい

11
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
12