Having trouble extending ActiveStorage::Attachment with acts_as_list

185 views Asked by At

Can someone offer best practices for adding acts_as_list to active storage attachments? The gem requires "acts_as_list" added to the model in question. I am hesitant to edit the ActiveStorage model in the gems directory but am new at extending ruby/rails.

All of this is about the coding hell I am in adding sorting to attached images!

1

There are 1 answers

0
Brendon Muir On

As far as I can tell, it's not a good idea to extend the ActiveStore class as that will extend it for all your uses. I've seen a suggestion to keep an array of attachment id's (ordered) in the parent model. You could use a serialised column for this backed by jsonb or something like that.