Skip to content

Instantly share code, notes, and snippets.

View ColinDKelley's full-sized avatar

Colin Kelley ColinDKelley

  • Invoca, Inc.
  • Santa Barbara, CA
View GitHub Profile
class User < ActiveRecord::Base
attr_default :first_name, 'First'
attr_default :last_name, 'Last'
attr_default :name_addr, lambda { "#{full_name} <#{email}>" }
attr_default :email, lambda { organization.default_email }
def full_name
[first_name, middle_name, last_name].select { |name| !name.blank? } * ' '
end
@ColinDKelley
ColinDKelley / user.rb
Created April 9, 2010 20:36
our user.rb with Hobo Fields
class User < ApplicationModel
fields :null=>false do
first_name :string
last_name :string
time_zone :string
encrypted_password :binary, :limit => 255
last_login_at :datetime, :null=>true
tos_agreed_date :datetime, :null=>true
registered_IP_address :string, :null=>true
contact_country_code :string, :limit => 3, :default => ""