One way to solve this issue is to use:
favorite = Favorite.new(item_id: params[:item_id], ... yada yada)
favorite.profile = profile
favorite.save!
Another way to solve this issue is to use the following code -- which I personally prefer:
profile.favorites.create!( item_id: params[:item_id], ...yada yada )
Extra Info can be ignored
class Profile
...
embeds_many :favorites, cascade_callbacks: true
...
end
to allow the running of the callbacks found in the Favorite
model