On 27 July 2012 08:07, Michael Pavling <pavl...@gmail.com> wrote:
> Which (if any) of those lines is line 26 in your UserController? What
> does the User.encrypt method look like?

Ignore me... I can't even read your error message properly myself.

>> I used the following action to encrypt the password.
>>>
>>>   def password
>>>     #debugger
>>>     @password1=pass
>>>     self.salt = SecureRandom.hex(10) if !self.salt?
>>>     self.password = User.encrypt(@password1, self.salt)
>>>   end
>>

Right... so where does the value of "pass" come from? Is there a
method that returns it?

In the (six year old) tutorial you're following, the method is:

  def password=(pass)
    @password=pass
    self.salt = User.random_string(10) if !self.salt?
    self.hashed_password = User.encrypt(@password, self.salt)
  end

but you've changed it to not take any attributes, and to update
"self.password" rather than "self.hashed_password". It would probably
help a little to post a bit more (all) of your model. Also, I'm
curious why, if you're following a tutorial, would you change large
chunks of the functionality? If you implement it exactly as described,
does it work?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to