我想从 this git repository 获得 ribbot 的开源代码.我已经下载了 rails 及其必要的 gem,以及 mongo db 并“安装了 bundle ”。 但是在运行项目时出现以下错误。
如何解决?
/Library/Ruby/Gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load': /Users/hansarijanto/Desktop/Impact/ribbot/config/initializers/session_store.rb:4:
syntax error, unexpected ':', expecting $end (SyntaxError) ...sion_store :cookie_store, key: '_ribbot_session', :domain =>...
我已经追踪到存在语法错误的文件,即 session_store.rb,目前看起来是这样的:
# Be sure to restart your server when you modify this file.
# See environment specific overrides also
Ribbot::Application.config.session_store :cookie_store, key: '_ribbot_session', :domain => :all, :expire_after => 10.years
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# Ribbot::Application.config.session_store :active_record_sto
最佳答案
您使用的是 Ruby 1.8,但使用的是 Ruby 1.9 hash syntax在你的 config/initializers/session_store.rb
中。以下片段:
key: '_ribbot_session'
应该是
:key => '_ribbot_session'
关于ruby-on-rails - Rails 项目无法启动 - 意外错误 : expecting $end,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10177833/