2010-02-02 2 views
9

Rack :: Session :: Cookie를 사용하여 세션을 공유하는 Sinatra/Rails 앱을 결합했습니다. 랙 :: 처리기 :: Thin.run 응용 프로그램 시작하면 응용 프로그램이 잘 작동하지만, rackup 파일이 얇은 시작 시작하면, 내가 랙에 오류가 발생 :: 세션 : 쿠키 :Rack :: Session : Sinatra, Thin, Rails 및 Rack을 사용한 쿠키 오류 :: Cascade


!! Unexpected error while processing request: no marshal_dump is defined for class Proc 
no marshal_dump is defined for class Proc 
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/session/cookie.rb:64:in `dump' 
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/session/cookie.rb:64:in `commit_session' 
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/session/cookie.rb:38:in `call' 
/usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.5/lib/thin/connection.rb:76:in `block in pre_process' 
/usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.5/lib/thin/connection.rb:74:in `catch' 
/usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.5/lib/thin/connection.rb:74:in `pre_process' 
/usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.5/lib/thin/connection.rb:57:in `process' 
/usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.5/lib/thin/connection.rb:42:in `receive_data' 
/usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine' 
/usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run' 
/usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.5/lib/thin/backends/base.rb:57:in `start' 
/usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.5/lib/thin/server.rb:156:in `start' 
/usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.5/lib/thin/controllers/controller.rb:80:in `start' 
/usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.5/lib/thin/runner.rb:177:in `run_command' 
/usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.5/lib/thin/runner.rb:143:in `run!' 
/usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.5/bin/thin:6:in `' 

rackup 파일은 다음과 같다 :

app = Rack::Builder.new { 
    use Rack::Session::Cookie, :key => '_example', :domain => 'example.org', :secret => 'secret' 
    use Rails::Rack::Static 
    run Rack::Cascade.new([Sinatra::Application, ActionController::Dispatcher.new]) 
}.to_app 

요 것 같은데 :


require ::File::dirname(__FILE__) + '/config/environment' 
require 'thin' 

app = Rack::Builder.new { 
    use Rails::Rack::Static 
    run Rack::Cascade.new([Sinatra::Application, ActionController::Dispatcher.new]) 
}.to_app 

use Rack::Session::Cookie, :key => '_example', :domain => 'example.org', 
    :secret => 'secret' 

# have to use this 
Rack::Handler::Thin.run app, :Port => 4000, :Host => "0.0.0.0" 
# want to use: run app 

답변

2

당신이 이런 식으로 뭔가를 시도 ur 문제는 app 외부에서 Rack :: Session :: Cookie를 사용하고 있다는 것입니다.

+0

이상하게도 Rack :: Session :: Cookie가 Rack :: Builder 블록 내부에있을 때만 발생합니다. Rack :: Session 블록은 얇은 시작 -R rackup.ru가 수행하는 것입니다. –