undefined method 'service_name' for ActiveStorage::Blob after upgrading to rails 6.1.0

Viewed 3795

I upgraded my app from 6.0.3.4 to 6.1.0 and got this error message. Looked it up and didn't find anything.

I have a very basic usage of ActiveStorage

error message

3 Answers

You need to create the new upgrade migrations via:

rails active_storage:update

Similar error message going from 6.0.2 -> 6.1.1 for me :

Can't resolve image into URL: undefined method `service_name'

again, the "rails active_storage:update" command fixes this by adding the required attributes to the database tables, but logging here as a search for the above error was returning nothing useful from Google at the time.

I know this is a little ridiculous, but I had the same error message on heroku (I had already updated ActiveStorage locally and everything was ready to go live).

All that was required was:

heroku restart

and everything worked as expected.

Related