Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notation "name: " vs ":name => " [duplicate]

I'm not too clear what's the difference between the follwing two notations:

= render :partial => "order_fields", :locals => { :t => type, :f => c}
= render :partial => "order_fields", :locals => { t: type, f: c}

They both seem to work but I can't understand what's the difference. Could you please help me?

like image 245
Don Giulio Avatar asked Jun 14 '26 10:06

Don Giulio


1 Answers

No difference. The latter is a new hash syntax in ruby 1.9.

(Why do I still call this "new syntax"? Ruby 1.9 is 4 years old, and it's not even the current version :))

like image 138
Sergio Tulentsev Avatar answered Jun 18 '26 00:06

Sergio Tulentsev