1

Rails で mongoid を使用するとエラーが発生します。

undefined method `eager_load' for Mongoid::Relations::Embedded::In:Class

構成ファイルで ID マップを有効にしました

identity_map_enabled: 真

そして、宝石を追加しようとしました

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

.....

何か案は

4

0 に答える 0