Class User
In: app/models/user.rb
Parent: ActiveRecord::Base

Models the users table, which stores information about users with permission to edit content. Has many changes. Email must be unique Email, password, user_level, first name, and last name must all not be null. Passwords must match their confirmations on creation. User level must be an integer between 1 and 3.

Methods

Attributes

old_password  [RW] 
password  [RW] 
password_confirmation  [RW] 

Public Class methods

Attempts to login a user. If a user with matching email and password is found, returns the user. Returns null otherwise. Not for use outside of this model.

Private Class methods

Hashes the given password using the Digest/SHA1 library function and returns the result.

Public Instance methods

Before a user‘s creation, hash the entered password and store the result as hashed_password.

Before a user is updated, hash the new password as in before_create.

Attempts to login a user. If a user with matching email and password is found, returns the user. Returns null otherwise. Intended for use outside of this model.

[Validate]