Since Rails 5.2 was released, we can make use of the Credentials API to manage our secrets.
Check out our previous blog on
to learn more about the working of the API.
config/credentials.yml.enc contains the following configuration:
Earlier we could only access the top-level key using the dot
(.) syntax (i.e., Using a method call).
The nested keys had to be accessed using the
As we can see in the last example, trying to access a nested key using the dot syntax raises a
the ability to access nested secrets using the dot syntax (i.e., Using a method call).
Now it is possible to access the nested key
access_key_id as follows: