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” %>
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 ?!
2014-03-07 14:54 GMT-03:00 Jedrin [email protected]:
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/7b84d5c6-e796-45dd-aaf2-0810f6655390%40googlegroups.comhttps://groups.google.com/d/msgid/rubyonrails-talk/7b84d5c6-e796-45dd-aaf2-0810f6655390%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.
–
Att, Antnio Augusto de Sousa Britto - 43 turma de Cincia da Computao -
UFU
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
On Friday, March 7, 2014 1:07:47 PM UTC-5, Antônio Augusto Sousa Britto
so this is valid syntax then, I never realized that
{mykey: ‘xx’’}
=> {:mykey=>“xx”}
On Friday, March 7, 2014 1:27:41 PM UTC-5, Jedrin wrote:
If there is some shorthand or special case I do not understand
To unsubscribe from this group and stop receiving emails from it, send
–
Att, Antônio Augusto de Sousa Britto - 43ª turma de Ciência da Computação
- UFU
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 ?)
2014-03-07 15:32 GMT-03:00 Jedrin [email protected]:
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/86b05b0a-b6c3-4294-be98-c55414df0b68%40googlegroups.comhttps://groups.google.com/d/msgid/rubyonrails-talk/86b05b0a-b6c3-4294-be98-c55414df0b68%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.
–
Att, Antnio Augusto de Sousa Britto - 43 turma de Cincia da Computao -
UFU
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs