“铁轨”与Activesupport这样3.2.0

时间:2021-10-21 12:59:28

I'm a new user of Ruby on rails and I try now to create my owen blog to practice this beautiful framework. So, after I did this commande to start server I got this error , and I thought that from ActiveSupport. I need a help :)

我是Ruby on rails的新用户,现在我尝试创建我的owen博客来实践这个漂亮的框架。所以,在我执行命令启动服务器之后,我得到了这个错误,我认为是从ActiveSupport。我需要帮助:)

The is the message error that I got :

我得到的信息错误是:

 ~/Bureau/blog$ rails server
=> Booting WEBrick
=> Rails 3.2.0.rc2 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/lib/ruby/gems/1.8/gems/activesupport-3.2.0.rc2/lib/active_support/dependencies.rb:245:in `load': /home/eayoub/Bureau/blog/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end (SyntaxError)
...sion_store :cookie_store, key: '_blog_session'
                              ^
    from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.0.rc2/lib/active_support/dependencies.rb:245:in `load'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.0.rc2/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.0.rc2/lib/active_support/dependencies.rb:245:in `load'
    from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/engine.rb:588
    from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/engine.rb:587:in `each'
    from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/engine.rb:587
    from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/initializable.rb:30:in `instance_exec'
    from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/initializable.rb:30:in `run'
    from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/initializable.rb:55:in `run_initializers'
    from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/initializable.rb:54:in `each'
    from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/initializable.rb:54:in `run_initializers'
    from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/application.rb:136:in `initialize!'
    from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/railtie/configurable.rb:30:in `send'
    from /usr/lib/ruby/gems/1.8/gems/railties-3.2.0.rc2/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /home/eayoub/Bureau/blog/config/environment.rb:5
    from /home/eayoub/Bureau/blog/config.ru:4:in `require'
    from /home/eayoub/Bureau/blog/config.ru:4
    from /usr/lib/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `instance_eval'
    from /usr/lib/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `initialize'
    from /home/eayoub/Bureau/blog/config.ru:1:in `new'
    from /home/eayoub/Bureau/blog/config.ru:1

2 个解决方案

#1


4  

Looks like you are running on Ruby 1.8.7, but the code you have written is only valid in Ruby 1.9.

看起来您在Ruby 1.8.7上运行,但是您所编写的代码在Ruby 1.9中是有效的。

If possible, I would recommend upgrading up to 1.9.3; that should fix the issue.

如果可能的话,我建议升级到1.9.3;这应该能解决这个问题。

If you cannot use Ruby 1.9.3, just change the line from

如果您不能使用Ruby 1.9.3,只需更改代码行

key: '_blog_session'

to

:key=>'_blog_session'

#2


0  

Are you running Ruby 1.9.x? The error is on a line using the new 1.9 hash syntax which is not backwards compatible. Try running ruby --v and seeing what version you're running. If its a 1.8.x you'll need to upgrade Ruby in order to run the latest version of Rails.

你在运行Ruby 1.9.x吗?错误出现在使用新的1.9哈希语法的行上,该语法不向后兼容。尝试运行ruby -v,看看您正在运行的版本。如果它的1.8。为了运行最新版本的Rails,您需要升级Ruby。

#1


4  

Looks like you are running on Ruby 1.8.7, but the code you have written is only valid in Ruby 1.9.

看起来您在Ruby 1.8.7上运行,但是您所编写的代码在Ruby 1.9中是有效的。

If possible, I would recommend upgrading up to 1.9.3; that should fix the issue.

如果可能的话,我建议升级到1.9.3;这应该能解决这个问题。

If you cannot use Ruby 1.9.3, just change the line from

如果您不能使用Ruby 1.9.3,只需更改代码行

key: '_blog_session'

to

:key=>'_blog_session'

#2


0  

Are you running Ruby 1.9.x? The error is on a line using the new 1.9 hash syntax which is not backwards compatible. Try running ruby --v and seeing what version you're running. If its a 1.8.x you'll need to upgrade Ruby in order to run the latest version of Rails.

你在运行Ruby 1.9.x吗?错误出现在使用新的1.9哈希语法的行上,该语法不向后兼容。尝试运行ruby -v,看看您正在运行的版本。如果它的1.8。为了运行最新版本的Rails,您需要升级Ruby。