我今天开始重新启动我的rails服务器,当我开始重新启动它时,这是我得到的错误。我已经尝试了一切,但未能破解它。我卸载并重新安装了activesupport 3.1.0,似乎activesupport本身有错误,我怀疑我可以解决。所以,让我感到困惑(让我感到困惑)。任何建议都非常感激。
$ RESQUE_INTERFACE=true rails s
=> Booting WEBrick
=> Rails 3.1.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load': /Users/nickgoddard/codebase/newshop/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end (SyntaxError)
...sion_store :cookie_store, key: '_newshop_session'
^
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/engine.rb:555
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/engine.rb:554:in `each'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/engine.rb:554
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `instance_exec'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `run'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/initializable.rb:50:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `each'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/application.rb:92:in `initialize!'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in `send'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/nickgoddard/codebase/newshop/config/environment.rb:5
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from /Users/nickgoddard/codebase/newshop/config.ru:4
from /Library/Ruby/Gems/1.8/gems/rack-1.3.6/lib/rack/builder.rb:51:in `instance_eval'
from /Library/Ruby/Gems/1.8/gems/rack-1.3.6/lib/rack/builder.rb:51:in `initialize'
from /Users/nickgoddard/codebase/newshop/config.ru:1:in `new'
from /Users/nickgoddard/codebase/newshop/config.ru:1
答案 0 :(得分:0)
您正在尝试在Ruby 1.8上运行Ruby 1.9代码,特别是session_store
哈希参数。
通常,当您创建一个新的Rails应用程序时,它应该知道这一点,但我不确定您如何设置应用程序的细节(或者您可能克隆了其他人的应用程序?)。要创建应用程序并强制它使用1.8样式的哈希,请执行:
rails new my_app --old-style-hash
或者,您可以使用类似rvm或rbenv的东西来安装Ruby 1.9并使用它。