Class: Guts::User

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

Overview

User model

Constant Summary collapse

VALID_EMAIL_REGEX =

Regex to test email against for validation

/\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i

Instance Method Summary collapse

Instance Method Details

#abilityClass

Gets the user’s abilties

Returns:

  • (Class)

    the abilities for this user

See Also:



40
41
42
# File 'app/models/guts/user.rb', line 40

def ability
  @ability ||= Guts::Ability.new self
end

#email=(email) ⇒ String

Setter override for email to downcase and strip email before database

Parameters:

  • email (String)

    the email to set

Returns:

  • (String)

    cleaned email string



33
34
35
# File 'app/models/guts/user.rb', line 33

def email=(email)
  self[:email] = email.downcase.strip
end