2014-03-09 14:43:33 -06:00
|
|
|
class User < ActiveRecord::Base
|
2014-04-05 19:18:57 -07:00
|
|
|
authenticates_with_sorcery! do |config|
|
2014-04-29 21:02:02 -06:00
|
|
|
config.authentications_class = Authentication
|
|
|
|
end
|
2014-03-09 14:43:33 -06:00
|
|
|
|
|
|
|
validates :password, presence: true, confirmation: true, length: { minimum: 3 }, unless: ("id?" || "password_confirmation?")
|
|
|
|
validates :password_confirmation, presence: true, unless: ("id?" || "password?")
|
|
|
|
|
|
|
|
validates :email, uniqueness: true
|
|
|
|
|
|
|
|
#validates_presence_of :avatar
|
|
|
|
#validates_integrity_of :avatar
|
|
|
|
#validates_processing_of :avatar
|
|
|
|
|
|
|
|
#has_secure_password validations: false
|
|
|
|
|
|
|
|
mount_uploader :avatar, AvatarUploader
|
|
|
|
|
|
|
|
has_many :user_organization_relationships
|
|
|
|
has_many :organizations, through: :user_organization_relationships
|
2014-04-29 21:02:02 -06:00
|
|
|
has_many :authentications, :dependent => :destroy
|
|
|
|
accepts_nested_attributes_for :authentications
|
2014-03-09 14:43:33 -06:00
|
|
|
|
|
|
|
end
|