2012-04-16 75 views
1

我想從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`負載':/用戶/ hansarijanto /桌面/影響/ ribbot /配置/initializers/session_store.rb:4:

語法錯誤,意外 ':',期待$結束(SyntaxError錯誤) ... sion_store:cookie_store,鍵: '_ribbot_session',:域名=> ...

我跟蹤了文件,語法錯誤是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

因爲ribbot使用Ruby 1.9的你應該更新你的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

3

您正在使用Ruby 1.8,但在config/initializers/session_store.rb中使用的是Ruby 1.9 hash syntax。下面的代碼片段:

key: '_ribbot_session' 

應該

:key => '_ribbot_session' 
+0

我試過了,但運行時仍然出現這個錯誤:/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/wrap_parameters.rb:8:語法錯誤,意外 ':',期待DMOZ目錄(SyntaxError錯誤) wrap_parameters格式:[:JSON] – 2012-04-16 16:24:05

+0

@HansAdiputraArijanto這是一個完全不同的文件,但它可能是同一個問題。檢查該文件並查看它是否也使用Ruby 1.9哈希語法,如果是,則以與我答案中相同的方式替換它。 – 2012-04-16 16:25:37

+1

如果我只是將我的紅寶石更新爲1.9,會更有利嗎? – 2012-04-16 16:26:21

相關問題