How can we use the Credentials feature in a 5.0.2 rails project? Is there any gem that has a similar approach?
You're best bet would be to upgrade to Rails 5.1.X if possible and use the encrypted secrets. It will at least get the code base up to a point where swapping out the encrypted secrets for credentials an easier task.
Thanks! But what can I do if at the moment I have to keep the 5.0.x version?
I'd say it would depend on how you're deploying to the production environment.
Basically, you can use your secrets.yml file to store all of the keys and values. Within each of the values, reference an environment variable. So, within the file, you may have something like this:
database_password: <%= ENV['DATABASE_PASSWORD'] %>
At least, in this way, you're not storing sensitive information in the codebase. From here, you can set your Environment Variables how you see fit. On a production deployment, it could be through ansible/chef/capistrano that is setting the ENV Vars or something similar.