Class: Dust::User

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.page(search, page) ⇒ Object



27
28
29
# File 'app/models/dust/user.rb', line 27

def self.page(search, page)
  search(search).paginate(:per_page => 12, :page => page)
end

.search(search) ⇒ Object



31
32
33
34
35
36
37
# File 'app/models/dust/user.rb', line 31

def self.search(search)
  if search
    where("username LIKE ?", "%#{search}%")
  else
    scoped
  end
end

Instance Method Details

#deliver_password_reset_instructions!Object



43
44
45
46
# File 'app/models/dust/user.rb', line 43

def deliver_password_reset_instructions!
  reset_perishable_token!
  PostOffice.password_reset_instructions(self).deliver
end

#has_role?(role) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'app/models/dust/user.rb', line 19

def has_role?(role)
  role_symbols.include?(role)
end

#is?(role) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'app/models/dust/user.rb', line 23

def is?(role)
  role_symbols.include?(role)
end

#loginObject



39
40
41
# File 'app/models/dust/user.rb', line 39

def 
  username
end

#role_symbolsObject



15
16
17
# File 'app/models/dust/user.rb', line 15

def role_symbols
  [(role.name).to_sym]
end