Mauro Avellaneda
Mauro Avellaneda

Reputation: 93

MASTER KEY NOT GENERATED RAILS 6

I have scaffolded a rails application (v6.0.3.4), after one day I realised that the master key wasn’t there. I know I can generate it, but it wouldn’t be the 'original', as I understand it.

Is it any possibility that the master key is there and I need a command to make it visible ? Is there any other solution than scaffolding again?

Upvotes: 2

Views: 2959

Answers (2)

Madrid
Madrid

Reputation: 19

  • Delete credentials.yml.enc & master.key
  • RUN EDITOR=nano rails credentials:edit

When you commit, master.key file will not be committed to Git as it is included in .gitignore by default.

Upvotes: 0

Yshmarov
Yshmarov

Reputation: 3729

If you did not use credentials in this project before:

  1. If there is a credentials.yml file available - delete it.
  2. To generate a new credentials.yml file + a master.key, you need to run in your console:

rails credentials:edit or EDITOR=vim rails credentials:edit

  1. the credentials.yml file will be automatically added to git. the master.key will not be commited for security reasons. Save it in a separate place.

Upvotes: 2

Related Questions