Skip to content

Instantly share code, notes, and snippets.

View jvnill's full-sized avatar

Jim Ruther Nill jvnill

View GitHub Profile
@jvnill
jvnill / client.rb
Created November 21, 2012 15:06
Core associations between contract, client, code and codeline
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
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"