This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Client < ActiveRecord::Base | |
attr_accessible :etc, :firstname, :lastname, :mi | |
has_many :contracts | |
validates :firstname, :lastname, :mi, presence: true | |
def full_name | |
"#{firstname} #{mi} #{lastname}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def attempt_login | |
if authorized_user = User.authenticate(params[:username], params[:hashed_password]) | |
session[:user_id] = authorized_user.id | |
session[:username] = authorized_user.username | |
case authorized_user.account_type | |
when "admin" | |
redirect_to :action => "index" | |
when "it" | |
redirect_to :action => "it" |
NewerOlder