Raffael
Raffael

Reputation: 45

Getting error while starting server in Aptana3, RoR

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'
                              ^

Upvotes: 0

Views: 140

Answers (2)

Alex
Alex

Reputation: 9471

The Ruby hash syntax was updated in 1.9. You can now create hashes like this:

hash = {
  foo: "bar",
  faz: "baz"
}

But you can still use the old 'hash rocket' style:

hash = {
  :foo => "bar",
  :faz => "baz"
}

In both implementations foo and faz are symbols.

Your problem is that key: => '_rails-test_session' is a franken-hash, you're trying to combin both styles of hash. Either use key: or :key =>.

Upvotes: 0

ranksrejoined
ranksrejoined

Reputation: 1237

key: => '_rails-test_session' is not valid Ruby. You can either do key => value or key: value, but they can't be combined.

Upvotes: 1

Related Questions