The PaperclipShrineSynchronization module

Hi,

I’m migrating from Paperclip to Shrine and I’m following this guide (Paperclip migration).

I’m writing here because I don’t know what to do with the PaperclipShrineSynchronization module, this is my code:

(config/initializers/shrine.rb)

(app/models/image_sliders.rb)

So, I have two questions about this:

1- I’m not sure if the PaperclipShrineSynchronization module should be in the config/initializers/shrine.rb file, should it be?
2- Once the migration is completed, should I remove the PaperclipShrineSynchronization module?

PS: I ran the migration for an object of ImageSlider model and it worked perfectly but I want to confirm if this is the correct way to do it.

The migration has been too easy, thank you for the excellent work you made!

Yes, you can have the PaperclipShrineSynchronization module defined anywhere, so config/initializers/shrine.rb works.

When you’ve deployed the PaperclipShrineSynchronization change, run the migration, and switched to Shrine (i.e. are not using Paperclip’s has_attached_file anymore), you can remove PaperclipShrineSynchronization together with other Paperclip code. The only purpose of that module is to synchronize Paperclip writes with Shrine writes, so once you’re not using Paperclip anymore you don’t need the module.

The migration has been too easy, thank you for the excellent work you made!

That’s great to hear! :heart:

1 Like

Excellent! Thanks for the quick reply.