0
1

More than 3 years have passed since last update.

rails5.2.4 で作成した既存のアプリを5.1.6にダウングレードする

Posted at

rails5.2.4で開発を進めていたのですが、既存のサービスとバージョンを合わせて管理がしたかったため、ダウングレードを選択しました。
環境はdockerで構築しているため、 ローカルの場合は使用しているPC等のrailsのバージョン変更が必要になります。

手順

1.Gemfileのrailsのバージョンを書き換える

Gemfile
gem "rails", "5.1.6"

2.bundle update (dockerのサービス名はwebにしています)

$ docker-compose run web bundle update

3.configの書き換え

application.rbのconfig.load_defaultsが5.2になっているので、5.1に変更

application.rb
 config.load_defaults 5.1

4.Active Recordの設定解除

application.jsのactive_storageの行を削除

application.js
//=require active_storage

configのactive_storageの行を削除

production.rb
config.active_storage.service = :local
development.rb
config.active_storage.service = :local

5.secrets.ymlを作成

config配下にsecrets.ymlを作成し、bundle exec rake secretで鍵の作成をする。

参考記事
https://qiita.com/tanishilove/items/2801059830e5af1262d7

6.最後にdevelopment.rbに残っているActive_storageの設定を削除

config.active_record.verbose_query_logsをfalseに変更

development.rb
config.active_record.verbose_query_logs = false

最後に

バージョンを下げる機会はなかなかないかと思いますが、困った時に参考になればと。

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