1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rails 6へアップグレードする時の注意点

1
Posted at

Rails 6へアップグレードする時の注意点

開発環境

  • rails 6
  • ruby 2.6.3

rails 6でWebpackerの利用について

WebpackerはRails 6におけるデフォルトのJavaScriptコンパイラですが、アプリケーションを以前のバージョンからアップグレードした場合は自動的には有効になりません。 Webpackerを使いたい場合は、以下をGemfileに追記し、rails webpacker:installコマンドを実行してインストールしてください。

gemにwebpackerを記述

gem "webpacker"
その後
rails webpacker:install

上記を行わないと、app/views/layouts/application.html.erbの以下部分が作動しない。
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> 

つまりHTMLでjavascriptが動かない。

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?