Class: User

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/user.rb

Overview

Schema Information

Table name: users

Columns

Name Type Attributes
admin boolean default("false"), not null
confirmation_sent_at datetime
confirmation_token string indexed
confirmed_at datetime
created_at datetime not null
current_sign_in_at datetime
current_sign_in_ip inet
email string default(""), not null, indexed
encrypted_password string default("")
failed_attempts integer default("0"), not null
id uuid not null, primary key
invitation_accepted_at datetime
invitation_created_at datetime
invitation_limit integer
invitation_sent_at datetime
invitation_token string indexed
invited_by_id uuid indexed
last_sign_in_at datetime
last_sign_in_ip inet
locked_at datetime
name string default("")
remember_created_at datetime
reset_password_sent_at datetime
reset_password_token string indexed
sign_in_count integer default("0"), not null
unconfirmed_email string
unlock_token string indexed
updated_at datetime not null
username string default(""), indexed

Indexes

  • users_ix_invited_by_id:
    • invited_by_id
  • users_uix_confirmation_token (unique):
    • confirmation_token
  • users_uix_email (unique):
    • email
  • users_uix_invitation_token (unique):
    • invitation_token
  • users_uix_reset_password_token (unique):
    • reset_password_token
  • users_uix_unlock_token (unique):
    • unlock_token
  • users_uix_username (unique):
    • username

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#loginObject

Returns the value of attribute login


60
61
62
# File 'app/models/user.rb', line 60

def 
  @login
end

Class Method Details

.find_first_by_auth_conditions(warden_conditions) ⇒ Object


65
66
67
68
69
70
71
72
73
74
# File 'app/models/user.rb', line 65

def self.find_first_by_auth_conditions(warden_conditions)
  conditions = warden_conditions.dup
   = conditions.delete(:login)

  if .present?
    where(conditions).where(['lower(username) = :login OR lower(email) = :login', { login: .downcase }]).first if 
  else
    where(conditions).first
  end
end

Instance Method Details

#send_reset_password_instructionsObject


76
77
78
# File 'app/models/user.rb', line 76

def send_reset_password_instructions
  super if invitation_token.nil?
end