Implementing automatic password generation.

This commit is contained in:
Jakub Troszok 2012-06-24 22:38:29 +02:00
parent 9132d309ad
commit 56dbfd2af3

View file

@ -53,7 +53,7 @@ class User < ActiveRecord::Base
scope :blocked, where(:blocked => true) scope :blocked, where(:blocked => true)
scope :active, where(:blocked => false) scope :active, where(:blocked => false)
before_validation :generate_password, :on1 => :create before_validation :generate_password, :on => :create
def generate_password def generate_password
if self.password.blank? && self.password_confirmation.blank? if self.password.blank? && self.password_confirmation.blank?