即时为我的网络应用程序使用rails 4.1.1和mongodb。并且即时整合facebook登录但我在保存或登录用户时出错。这是错误
Moped::Errors::QueryFailure - The operation: #<Moped::Protocol::Query
@length=93
@request_id=2
@response_to=0
@op_code=2004
@flags=[]
@full_collection_name="projectsad_development.usersfbs"
@skip=0
@limit=0
@selector={"_id"=>{"$oid"=>BSON::ObjectId('53c467994d696c0bf6000000')}}
@fields=nil>
failed with error 10068: "invalid operator: $oid"
确定下降的代码
<% if current_user %>
Welcome <strong><%= current_user.name %></strong>!
<%= link_to "Sign out", signout_path, id: "sign_out" %>
<% else %>
<%= link_to "Sign in with Facebook", "/auth/facebook", id: "sign_in" %>
<% end %>
继承人我把current_user def放在哪里
def current_user
@current_user ||= Usersfb.find(session[:user_id]) if session[:user_id]
end
helper_method :current_user
答案 0 :(得分:0)
我遇到了同样的问题,并在cookies_serializer.rb的帮助下评论了这一行:
Rails.application.config.action_dispatch.cookies_serializer = :json
有关此问题的更多信息:https://github.com/plataformatec/devise/issues/2949#issuecomment-49261044