Let's say I have two models: board, that belongs to an user, and sharing which is embedded into board
board.rb
belongs_to :user
embeds_one :sharing
is possible to set the foreign key "user_id" in a field in sharing, something like:
belongs_to :user, :foreign_key => 'sharing.user_id'
Yes, just add user_id as a field on your embedded Sharing model.
.
so you have to use the []
notation. However for embedded documents you should be all right using the dot notation - Tyler Brock 2012-04-06 16:31