Open and edit Rails 5.2 credentials file
Public, Rails General
Created: Oct 12, 2018 Updated: Oct 12, 2018
Here is an example of how to open and edit the new credentials file that came out in Rails 5.2. This example is using Sublime as the editor.
➜ EDITOR="subl --wait" rails credentials:edit
This will open up the
credentials.yml file in sublime.
For example, let's set:
This should output the following to the terminal:
New credentials encrypted and saved.
You can access the key by calling:
This can be called anywhere in your code, as well as from the Rails console directly.