在 Aptana3、RoR 中启动服务器时出现错误
恐怕我有一个有点愚蠢的问题,但我自己无法解决这个问题:
alex@ALFA:~/Aptana Studio 3 Workspace/rails-test$ rails server
=> Booting WEBrick
=> Rails 3.1.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/var/lib/gems/1.8/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load': /home/alex/Aptana Studio 3 Workspace/rails-test/config/initializers/session_
store.rb:3: syntax error, unexpected ':', expecting $end (SyntaxError)
...sion_store :cookie_store, key: => '_rails-test_session'
^
I'm afraid that I have a bit silly question, but I wasn't able to solve this problem myself:
alex@ALFA:~/Aptana Studio 3 Workspace/rails-test$ rails server
=> Booting WEBrick
=> Rails 3.1.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/var/lib/gems/1.8/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load': /home/alex/Aptana Studio 3 Workspace/rails-test/config/initializers/session_
store.rb:3: syntax error, unexpected ':', expecting $end (SyntaxError)
...sion_store :cookie_store, key: => '_rails-test_session'
^
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
键:=> “_rails-test_session”
不是有效的 Ruby。您可以执行key =>; value
或key: value
,但它们不能组合。key: => '_rails-test_session'
is not valid Ruby. You can either dokey => value
orkey: value
, but they can't be combined.Ruby 哈希语法在 1.9 中进行了更新。您现在可以像这样创建哈希:
但您仍然可以使用旧的“哈希火箭”样式:
在两个实现中
foo
和faz
都是 符号。你的问题是
key: =>; '_rails-test_session'
是一个弗兰肯哈希,您正在尝试组合两种样式的哈希。使用key:
或:key =>
。The Ruby hash syntax was updated in 1.9. You can now create hashes like this:
But you can still use the old 'hash rocket' style:
In both implementations
foo
andfaz
are symbols.Your problem is that
key: => '_rails-test_session'
is a franken-hash, you're trying to combin both styles of hash. Either usekey:
or:key =>
.