New Ruby 1.9 hash syntax
new_hash = {:simon => "Talek", :lorem => "Ipsum"} can be replaced by
new_hash = {simon: "Talek", lorem: "Ipsum"} Is there a shorter way to record
:on => :collection Applying the same logic causes an error:
on: :collection Refresh to provide more information:
In my .rb routes:
get 'detail', { on: :member } does not work. Also
get 'detail', on: :member Error:
Exiting SyntaxError: C:/Workspace/OE_11/CyberTrack_Rails3/config/routes.rb:23: syntax error, unexpected ':' get 'detail', { on: :member } or
Exiting SyntaxError: C:/Workspace/OE_11/CyberTrack_Rails3/config/routes.rb:23: syntax error, unexpected ':' get 'detail', on: :member This works fine for me:
def get(*args) p *args end get 'detail', on: :member # "detail" # { :on => :member } RUBY_ENGINE # => jruby JRUBY_VERSION # => 1.6.6 EDIT: Now that you have provided the error message, it looks like you are not using Ruby 1.9. The new hash syntax was introduced in Ruby 1.9; it does not work in older versions. You need to make sure that you are using Ruby 1.9, either by checking that you are using the correct Ruby implementation (for example, YARV supports 1.9, MRI does not work), or if you are using a Ruby implementation that supports several language versions (for example, JRuby), which you pass the correct command line flags (e.g. jruby --1.9 ).