hello, i’ve come across a code like
def password=(pass)
@password = pass
.
.
end
Anyone can please explain to me what is happening in the first line
itself for the def part? the code I saw did not provide anything on it
hello, i’ve come across a code like
def password=(pass)
@password = pass
.
.
end
Anyone can please explain to me what is happening in the first line
itself for the def part? the code I saw did not provide anything on it
On 27 June 2012 19:54, Ritesh T. [email protected] wrote:
hello, i’ve come across a code like
def password=(pass)
@password = pass
.
.
endAnyone can please explain to me what is happening in the first line
itself for the def part? the code I saw did not provide anything on it
It is setting the instance variable @password to the parameter ‘pass’
that is passed in to the method. I suggest running through some basic
Ruby tutorials.
If you meant what is the line starting with def doing, then you still
need to look at the tutorials.
Colin
thanks Colin, I’ve started with the rails tutorials but it was the
password=(pass) which confused me somehow
On 27 June 2012 20:35, Ritesh T. [email protected] wrote:
thanks Colin, I’ve started with the rails tutorials but it was the
password=(pass) which confused me somehow
Have a look at http://www.rubyist.net/~slagell/ruby/accessors.html
Colin
thanks for the link, i’ve bought some RoR books to get further info, but
if you have some websites with some easy to use examples for a beginner
am most welcome to accept them 
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