...like this: paperclip2active_storage
Update be sure to watch the linked video presentation as the text document does not present all the quirks!
so I installed and configured rails 7 and gem 'mini_magick'. Now I suppose the referenced script will update all my models, views and controllers:
but, when I run it I get error like this:
leder@home-ryzen-desktop:~/Git/gmr_production_heroku$ ruby migration.rb
migration.rb:1:in `<main>': uninitialized constant ActiveRecord (NameError)
migration.rb
as described in the referenced link!
How do I do migrate my RoR App?
I have removed development
from database.yml
and added to storage.yml
:
test:
service: Disk
root: <%= Rails.root.join("tmp/storage") %>
local:
service: Disk
root: <%= Rails.root.join("storage") %>
amazon:
...
Now I get this error:
leder@home-ryzen-desktop:~/Git/gmr_production_heroku$ bundle exec rake db:create
rake aborted!
ActiveRecord::AdapterNotSpecified: The `development` database is not configured for the `development` environment.
Available database configurations are:
production
/home/leder/.rbenv/versions/3.0.1/bin/bundle:23:in `load'
/home/leder/.rbenv/versions/3.0.1/bin/bundle:23:in `<main>'
Tasks: TOP => db:create => db:load_config
(See full trace by running task with --trace)
How do I migrate this to active_storage
?
Follow up question can be found here: Part2
You need to run the migration in the context of Rails. So ruby migration.rb
won't work.
You need to generate a migration with bin/rails g migration <migration_name>
.
Then once you copy the code into the migration, run bin/rails db:migrate
.
P.S. Rails 7 hasn't been released yet. So moving to Rails 7 might be premature since it may still have bugs and many gems may not support it fully