我有一个 Rails 4 应用程序。“退出”在计算机浏览器中完美运行,但在我尝试从移动浏览器退出时出错。
#Sign out using comp browser
Started DELETE "/users/sign_out" for 127.0.0.1 at 2013-09-12 10:40:40 +0530
Processing by SessionsController#destroy as HTML
Parameters: {"authenticity_token"=>"pp6ZHEz2JQbuh3YzM87OOLpiq3Yb/PauYY7k7gwhl94="}
MOPED: 127.0.0.1:27017 QUERY database=app_development collection=users selector={"$query"=>{"_id"=>"52314382f94adc80ab000002"}, "$orderby"=>{:_id=>1}} flags=[:slave_ok] limit=-1 skip=0 batch_size=nil fields=nil (0.4578ms)
Redirected to http://localhost:3000/
Completed 302 Found in 40ms
Started GET "/" for 127.0.0.1 at 2013-09-12 10:40:40 +0530
Processing by HomeController#index as HTML
Completed 401 Unauthorized in 1ms
Started GET "/users/sign_in" for 127.0.0.1 at 2013-09-12 10:40:40 +0530
Processing by SessionsController#new as HTML
Rendered devise/shared/_links.html.haml (0.6ms)
Rendered devise/sessions/new.html.haml within layouts/login (7.3ms)
Rendered shared/_flash_notice.html.haml (0.3ms)
Rendered shared/_ie.html.haml (0.1ms)
Completed 200 OK in 38ms (Views: 36.5ms)
#Sign out using mobile browser
Started GET "/users/sign_out" for 192.168.1.153 at 2013-09-12 10:40:53 +0530
Processing by UsersController#show as HTML
Parameters: {"id"=>"sign_out"}
MOPED: 127.0.0.1:27017 QUERY database=app_development collection=users selector={"$query"=>{"_id"=>"5231438bf94adc80ab000009"}, "$orderby"=>{:_id=>1}} flags=[:slave_ok] limit=-1 skip=0 batch_size=nil fields=nil (1.3361ms)
MOPED: 127.0.0.1:27017 QUERY database=app_development collection=users selector={"_id"=>"sign_out"} flags=[:slave_ok] limit=0 skip=0 batch_size=nil fields=nil (0.4921ms)
Completed 404 Not Found in 9ms
Mongoid::Errors::DocumentNotFound (
Problem:
Document(s) not found for class User with id(s) sign_out.
Summary:
When calling User.find with an id or array of ids, each parameter must match a document in the database or this error will be raised. The search was for the id(s): sign_out ... (1 total) and the following ids were not found: sign_out.
Resolution:
Search for an id that is in the database or set the Mongoid.raise_not_found_error configuration option to false, which will cause a nil to be returned instead of raising this error when searching for a single id, or only the matched documents when searching for multiples.):
app/controllers/users_controller.rb:10:in `show'
我在应用程序控制器中有 jquery 和 jquery_ujs。
//= require jquery
//= require jquery_ujs
我认为 jquery_ujs 没有在移动浏览器中加载。我尝试了几个不同的单元格(苹果,android n windows),但得到了同样的错误。