syntax: render partial: "account"


 The syntax of partial here does not make sense to me. If it was :partial then it's a symbol, but
what is it this way ?

<%= render partial: "account" %>

its a hash of parameters to the render method ?!

this isn’t valid syntax because of the colon at the end of ‘something’

my_var = something:

this is not valid

key: ‘car’

If there is some shorthand or special case I do not understand

so this is valid syntax then, I never realized that

{mykey: ‘xx’’}

=> {:mykey=>“xx”}

yes. in hashes the longer, traditional form is:

<%= render :partial => “account” %>

you can now just write:

<%= render partial: “account” %>

actually, in the case of rendering a partial, usually you don’t need to even say partial, you write:

<%= render “account” %>

the filename, if it’s a partial, will begin with an underscore, such as _account.html.erb and rails will know it’s a partial. the only conflict would arise if you have both an account.html.erb and an _account.html.erb.

I guess it is the new hash notation. Not sure which version of Ruby implements it ( > 2.0 ?)