If you are like many (most?) of us, you have encountered Rails
Credentials/Secrets and secret_key_base and may have been
left a bit (or more) confused.
This post is an attempt to remove some of that confusion by
| source 'https://rubygems.org' | |
| # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
| gem 'rails', '~> 6.0.0' | |
| # Shorten boot time | |
| gem 'bootsnap' | |
| # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder | |
| gem 'jbuilder', github: 'rails/jbuilder' |
| # app/helpers/application_helper.rb | |
| module ApplicationHelper | |
| # active_storage_item could be a blob or variant object | |
| def proxy_url(active_storage_item, options = {}) | |
| options.merge!(host: ENV['ASSETS_HOST']) if ENV['ASSETS_HOST'].present? | |
| # proxy: 'true' allows you to stil have the original functionality while | |
| # being able to proxy through a CDN. You've got to ensure that your CDN | |
| # forwards this param otherwise active storage will always do the default | |
| # behavior which is a redirect to the service. |
| Copyright (C) 2011 by Colin MacKenzie IV | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in |