Which syntax is preferred to create a Hash in Ruby on Rails?
It depends. I prefer the newer syntax because I feel that it is more readable. As others have pointed out, however, the newer syntax is only compatible with Ruby 1.9.2+.

You should be aware, however, that the new syntax does not entirely replace the hash rocket syntax. This is because you can only use the newer syntax with symbols.

{ "text": :hello } #=&gt; syntax error, unexpected ':', expecting =&gt;


If you want to use strings and methods, you will still need to use the has rocket:

{ method_name =&gt; :hello }
{ "a_string" =&gt; :hello }


Personally, from my experience of reading and watching educational materials, the newer syntax is preferred where possible. It's also less keystrokes: : instead of =&gt; is easier for me.