gem 'rails', '3.0.0'
gem 'devise'
gem 'bson_ext', '>= 1.0.7'
gem 'bson', '>= 1.0.7'
gem 'mongo_mapper', :branch => 'rails3', :git => 'http://github.com/jnunemaker/mongomapper.git'
gem 'devise-mongo_mapper', :git => 'git://github.com/collectiveidea/devise-mongo_mapper'
通过上述设置,我在请求时遇到以下错误:
Started GET "/users/sign_out" for 127.0.0.1 at 2010-09-27 13:16:30 +0300
Processing by Devise::SessionsController#destroy as HTML
Redirected to http://localhost:3000/
Completed 302 Found in 19ms
[2010-09-27 13:16:31] ERROR Errno::ECONNRESET: Connection reset by peer
/usr/local/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:56:in `eof?'
/usr/local/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:56:in `run'
/usr/local/ruby/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
Started GET "/users/edit" for 127.0.0.1 at 2010-09-27 13:16:35 +0300
Processing by Devise::RegistrationsController#edit as HTML
Completed in 16ms
[2010-09-27 13:16:35] ERROR Errno::ECONNRESET: Connection reset by peer
/usr/local/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:56:in `eof?'
/usr/local/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:56:in `run'
/usr/local/ruby/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
用户模型:
class User
include MongoMapper::Document
plugin MongoMapper::Devise
devise :registerable, :database_authenticatable, :recoverable
end
想法?
答案 0 :(得分:12)
WebRick已被Thin取代。
执行以下操作对我有用:
<强>的Gemfile:强>
gem 'thin'
现在做bundle install
答案 1 :(得分:3)
我的快速猜测是,您的会话存在问题,而protect_from_forgery正在加入。
我遇到了类似的问题,并将我的头撞到了墙上几天,事实证明我是将整个对象分配给会话对象而不仅仅是id。快速说明,非GET请求是触发protect_from_forgery的请求。
答案 2 :(得分:0)
将此添加到我的 development.rb 文件修复了此问题。
config.assets.raise_runtime_errors = true
config.web_console.whitelisted_ips = replace_this_with_the_public_ip
答案 3 :(得分:-4)
WebRick已被Thin取代。
执行以下操作对我有用
的Gemfile:
gem 'thin'
bundle install
此选项也适用于我的项目