-
Type:
Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Looks like when I use has_and_belongs_to_many and has_one for a model, will have a bug.
class User include Mongoid::Document field :name # has_and_belongs_to_many :favorited_shops, :stored_as => :array, :inverse_of => :favoritors, :class_name => "Shop" has_and_belongs_to_many :followed_shops, :stored_as => :array, :inverse_of => :followers, :class_name => "Shop" has_one :shop end class Shop include Mongoid::Document field :title # This is work fine. # has_and_belongs_to_many :favoritors, :stored_as => :array, :inverse_of => :favorited_shops, :class_name => "User" # This can not working has_and_belongs_to_many :followers, :stored_as => :array, :inverse_of => :followed_shops, :class_name => "User" belongs_to :user end
when I use:
ruby> u = User.first
ruby> u.shop = Shop.new
or
ruby> u.create_shop(...)
I well be fail:
Mongoid undefined method `map' for <User:....>