Hi, everybody! I'm new on both this site and ruby on rails! I have a common installation of authlogic and want password to be generated automaticly for user registration if user did not set the password. What is the best way to do it?
+2
A:
The solution is:
#app/models/User.rb
class User < ActiveRecord::Base
#...
before_validation_on_create { |record| record.randomize_password unless record.password }
#...
end
vooD
2010-03-31 08:57:12