我在使用带有 mongoid 的 rails 时遇到错误。
undefined method `eager_load' for Mongoid::Relations::Embedded::In:Class
我在配置文件中启用了身份映射
identity_map_enabled:真
我已经尝试添加宝石
宝石“mongoid-eager-loading”
我真的不在乎它是否渴望加载...
控制器代码片段...在第 7 行爆炸
7 auth = Authentication.includes(:user).where(provider: omniauth['provider'],uid: omniauth['uid']).first
8 if auth
9 user = auth.user
10 else
11 user = User.from_omniauth(omniauth)
12 end
型号代码片段
class User
2 include Mongoid::Document
3 include Mongoid::Timestamps
4 include Mongoid::Paranoia
5 field :first_name, type: String
6 field :last_name, type: String
7 field :user_id, type: String
8 field :type, type: String
9 field :facebook_id, type: String
10 field :twitter_id, type: String
11 field :name, type: String
12 field :nickname, type: String
13 field :email, type: String
14 field :website, type: String
15 field :location, :type => String
17 field :omniauth_profile_image_url, :type => String
19 validates_uniqueness_of :user_id, :facebook_id , :twitter_id
20 validates_presence_of :user_id, :first_name , :last_name, :type , :facebook_id , :twitter_id
21 validates_presence_of :email, :on => :update
22 validates_presence_of :name
23 validates_uniqueness_of :email
......
有任何想法吗