Rails项目无法启动 - 错误意外:期待$ end

时间:2012-04-16 16:16:58

标签: ruby-on-rails ruby

我想让ribbot成为this git repository的开源代码。我已经下载了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:

     

语法错误,意外':',期待$ end(SyntaxError)       ... sion_store:cookie_store,key:'_ urbbot_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

2 个答案:

答案 0 :(得分:3)

您正在使用Ruby 1.8,但在config/initializers/session_store.rb中使用Ruby 1.9 hash syntax。以下代码段:

key: '_ribbot_session'

应该是

:key => '_ribbot_session'

答案 1 :(得分:2)

因为ribbot正在使用ruby 1.9你应该更新你的ruby版本,而不是更改代码使其工作,当前的ruby版本是1.9.3 http://www.ruby-lang.org/en/downloads/

安装说明

  • 如果你使用的是mac OS:

http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac

  • 如果您使用的是ubuntu linux:

http://www.rubyinside.com/how-to-install-ruby-1-9-2-and-rails-3-0-on-ubuntu-10-10-4148.html