What’s the difference between colon “:” and fat arrow “=>” [duplicate]

The syntax is for defining Hash key/value pairs, and the difference depends on the Ruby version.

Supported in both Ruby 1.8 and Ruby 1.9

:foo => true

Supported only in Ruby 1.9

foo: true

If you’re developing in Ruby 1.9 you should probably use the syntax:

foo: true

as it appears to be the direction the community is moving in.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)