ArgumentError

i met an error that goes like this (even though i followed the book word for word)

but not symbol for symbol :_

ArgumentError in Login#add_user Showing app/views/login/add_user.rhtml where line #16 raised:

wrong number of arguments (0 for 1)

Extracted source (around line #16): 16: <%= form.password_field :password, :size => 40 %>

  def password     @password   end

def password(pwd)    @password = pwd    create_new_salt    self.hashed_password = User.encrypted_password(self.password, self.salt) end

So line 16 is trying to read the password attribute, ie it tries to call the password method. You've defined the password method as taking one argument, so it all falls over. You probably meant def password=(pwd)    @password = pwd    ... end

Fred

Just to beat the h3ll out of the obvious. He RE-defined the password method.

The fact that Ruby considers only the method name and not the parameters is something which trips up folks who have used languages like C++ and Java and are expecting to be able to overload methods.