Reputation: 61
I have two fields on a model called Project:
has_one_attached :image
has_many_attached :assets
I want to move the image to the assets so I can get rid of the has_one_attached :image.
Upvotes: 2
Views: 300
Reputation: 61
I answered my own question but thought it would be useful to share:
p = Project.find(id)
p.assets.attach(p.image.blob)
p.image.detach
This successfully removed the image and moved it to assets.
Upvotes: 2