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?
Asked
Active
Viewed 374 times
4
1 Answers
4
The solution is:
#app/models/User.rb
class User < ActiveRecord::Base
#...
before_validation_on_create { |record| record.randomize_password unless record.password }
#...
end

vooD
- 2,881
- 2
- 25
- 34