I haven't tried adding it to an "older" version of rails. It does seem to be fairly decoupled from Rails as its own gem.
Though, one weird thing that they do which is a little strange that could prevent this from easily working is in the ActiveStorage gemspec.
```ruby
s.add_dependency "actionpack", version
s.add_dependency "activerecord", version
```
It has this reference to version which is in the main branch's `RAILS_VERSION` file. If you reference a `5.1.6` tag, the ActiveStorage gem wouldn't exist. You may need to clone the repo and manually adjust it. This would inherently add a level of technical debt as you would have to migrate any bugfixes/security patches/enhancements to your branch.
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.
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:
```
production:
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.
It is just a different way to parse the JSON. If you wanted to reference the object, you could do it with something like `version.object['first_name']` but I think that something like `version.changed_object.first_name` appears nicer. It is really just a preference.