I'm having a bit of trouble with using Active Storage on a Rails 5.2 app, which I only recently started building.
As an experiment, I set up a fresh rails application and set up Active Storage as the first thing, then built out a new scaffold, and it worked on the fresh application.
To really boil this down, if I go to the rails console for the non-working application, I get this:
> rails c
Running via Spring preloader in process 47792
Loading development environment (Rails 5.2.1)
[1] pry(main)> ActiveStorage
=> ActiveStorage
[2] pry(main)> ActiveStorage::Blob
TypeError: no implicit conversion of Symbol into String
from (erb):12:in `[]'
In the working application, I get this:
> rails c
Running via Spring preloader in process 48340
Loading development environment (Rails 5.2.1)
irb(main):001:0> ActiveStorage
=> ActiveStorage
irb(main):002:0> ActiveStorage::Blob
=> ActiveStorage::Blob (call 'ActiveStorage::Blob.connection' to establish a connection)
For whatever reason, it appears that Active Storage is only partially loaded. Any idea what might be causing this?
Oddly enough, after removing all commented lines in my
storage.yml
, Active Storage worked. So the solution is to remove all comments instorage.yml
.