I solved the problem with this code:
class User < ActiveRecord::Base

  has_secure_password
  validate :password_unique?

  protected

  def password_unique?
    users = User.find_all_by_email(email)
    if users.any?
      users.each do |u|
        errors.add(:password, "Must be unique within email scope") if
u.authenticate(password)
      end
    end
  end

end

Thanks for the responses.

On Aug 23, 12:28 pm, billv <[email protected]> wrote:
> Exactly.  Boiling it down, that's what I'm asking.  Where is the hook?
>
> Thanks.
>
>
>
>
>
>
>
>
>
> > I don't know where to hook into has_secure_password to do this, but it 
> > occurs to me that if you provide a salt yourself before calling it, that 
> > should work shouldn't it?
>
> > --
> > Scott Ribe
> > [email protected]http://www.elevated-dev.com/
> > (303) 722-0567 voice

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to