explanation required on def method = (.)

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

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

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 :slight_smile: