| Class | User |
| In: |
app/models/user.rb
|
| Parent: | ActiveRecord::Base |
A User is used to validate administrative staff. The class is complicated by the fact that on the application side it deals with plain-text passwords, but in the database it uses SHA1-hashed passwords.
| password | [RW] | The plain-text password, which is not stored in the database |
Clear out the plain-text password once we’ve saved this row. This stops it being made available in the session
# File app/models/user.rb, line 57
57: def after_create
58: @password = nil
59: end
Don‘t delete the last user from the database
# File app/models/user.rb, line 50
50: def check_more_than_one_user
51: raise "Less than two users" unless User.count > 1
52: end