On 11 July 2015 at 14:19, Richard Zanabria <lists@ruby-forum.com> wrote:
> Thanks Colin, i foloow your advice.
>
> One question:
>
> in:
> def calcular_neto(2) # it´s necesary (2) , I dont know how its work
> (2).
>
>
> It is not enough that this ?
>
> attr_accessor :auto01, :auto02
In the initialiser you can either use @auto.. or self.auto.. The
latter will use the accessor. This is necessary even if you change
the parameter name in the initialiser so that it is not the same as
the accessor.
It seems that in fact you do not need either in calculator_neto but I
am not sure why it is necessary in the initialiser but is not
necessary there. Probably someone more knowledgeable will explain.
Colin
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLupVsizHicrvLsB4pZA8qSAAqrgMVo76KdgtB%3DmzbK32w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment