我使用带有mongoid的rails时遇到错误。
undefined method `eager_load' for Mongoid::Relations::Embedded::In:Class
我在配置文件中启用了身份映射
identity_map_enabled:true
我尝试添加宝石
gem“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
.....
任何想法