2010-04-14 13:15:27 -04:00
|
|
|
class Admin::User < ActiveRecord::Base
|
|
|
|
belongs_to :account
|
2011-10-13 18:54:53 -04:00
|
|
|
store :settings, :accessors => [ :color, :homepage ]
|
2012-09-13 10:12:11 -04:00
|
|
|
store_accessor :settings, :favorite_food, :phone_number
|
2012-02-02 13:57:15 -05:00
|
|
|
store :preferences, :accessors => [ :remember_login ]
|
2012-05-09 11:20:14 -04:00
|
|
|
store :json_data, :accessors => [ :height, :weight ], :coder => JSON
|
|
|
|
store :json_data_empty, :accessors => [ :is_a_good_guy ], :coder => JSON
|
2012-09-13 10:12:11 -04:00
|
|
|
|
|
|
|
def phone_number
|
|
|
|
read_store_attribute(:settings, :phone_number).gsub(/(\d{3})(\d{3})(\d{4})/,'(\1) \2-\3')
|
|
|
|
end
|
|
|
|
|
|
|
|
def phone_number=(value)
|
|
|
|
write_store_attribute(:settings, :phone_number, value && value.gsub(/[^\d]/,''))
|
|
|
|
end
|
2011-10-13 18:54:53 -04:00
|
|
|
end
|