Reputation: 1750
I am running JRuby version 1.6.7 with Rails 3.2.3 and when I launch my rails server rails s
I get the following error:
/config/routes.rb:8: syntax error, unexpected ':'
match '/about', to: 'pages#about'
However, if I change to match '/about' :to => 'pages#about'
I don't get the error. Since this shorthand format is supported in the version of Rails in use, what is the problem and how do I resolve it?
Upvotes: 1
Views: 132
Reputation: 239531
The key: value
syntax was introduced by Ruby 1.9 to supersede 1.8's :key => value
syntax. The version of Rails is irrelevant; unless your version of Ruby is at least 1.9, you cannot use the new key: value
syntax for hashes.
Upvotes: 0
Reputation: 3861
The hash syntax comes from Ruby implementations, not Rails. JRuby can run in either 1.9 or 1.8 mode. It runs in 1.8 mode by default. You can read about configuring JRuby to run in 1.9 mode on the wiki.
Upvotes: 3