# ENV["ASSETS_HOST"] = 'thing.cloudfront.net'
class Foo < ApplicationRecord
has_one_attached :thing
end
foo = Foo.first
# https://thing.cloudfront.net/rails/active_storage/blobs/etc..etc
proxy_url(foo.image)
# https://thing.cloudfront.net/rails/active_storage/representations/etc..etc
proxy_url(foo.image.variant(resize: '100x100'))
This is nowhere near perfect. Just gets the job done in a simple manner.
Inspiration from https://github.com/rails/rails/pull/34477
Hey @ArthurTruong5,
I'm sorry for the late reply, I missed these comments in my mailbox.
I realised that in the application that I've been working on, a previous developer added this line to the
application.rb
and hence why I didn't run into this problem.config.eager_load_paths += %W(#{config.root}/lib)
Did you come right with this problem or is it still throwing a
NameError
?