I made the early novice-mongodb mistake awhile back and make a lot of has_many relations when I should have been embedding them.
My question is how can I now convert my records from a polymorphic has_many scenario to embeds_many?
#Place.rb
has_many :images, as: :imageable, dependent: :destroy, autosave: true
#Image.rb
belongs_to :imageable, polymorphic: true
to =>
#Place.rb
embeds_many :images, as: :imageable
#Image.rb
embedded_in :imageable, polymorphic: true
I would normally iterate thru all the records and do it that way but I imagine the naming is gonna be a problem. So i'm not sure how I can accomplish this short of creating a temporary model, but I'm hoping a few others have made the same mistake and possibly have a gentle solution?