Reputation: 1448
When you have a relation such as embeds_many :album_items
which relates to the AlbumItem
model. How can I have it stored in just items
. I tried embeds_many :album_items, :as => :items
and embeds_many :items, :class_name => AlbumItem
. Neither worked.
How can I go about renaming the relation?
Thanks
Upvotes: 3
Views: 1709
Reputation: 10874
Does this work(assuming your parent model name is Album
)?
In Album:
embeds_many :items, :class_name => "AlbumItem", :inverse_of => :album
and in AlbumItem:
embedded_in :album, :class_name => "Album", :inverse_of => :items
Upvotes: 7