Class: User
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- User
- Defined in:
- app/models/user.rb
Overview
Schema Information
Table name: users
id :integer not null, primary key
email :string(255) default(""), not null
encrypted_password :string(255) default(""), not null
reset_password_token :string(255)
reset_password_sent_at :datetime
remember_created_at :datetime
sign_in_count :integer default(0)
current_sign_in_at :datetime
last_sign_in_at :datetime
current_sign_in_ip :string(255)
last_sign_in_ip :string(255)
password_salt :string(255)
confirmation_token :string(255)
confirmed_at :datetime
confirmation_sent_at :datetime
unconfirmed_email :string(255)
failed_attempts :integer default(0)
unlock_token :string(255)
locked_at :datetime
authentication_token :string(255)
created_at :datetime not null
updated_at :datetime not null
gender :boolean
title :string(255)
firstname :string(255)
lastname :string(255)
function :string(255)
phone :string(255)
fax :string(255)
facebook :string(255)
twitter :string(255)
linkedin :string(255)
googleplus :string(255)
enable_expert_mode :boolean default(FALSE)
Instance Method Summary collapse
Instance Method Details
#anrede ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'app/models/user.rb', line 71 def anrede if self.lastname == "n.v." r = "Sehr geehrte Damen und Herren" else if self.gender == true r = "Sehr geehrter Herr" else r = "Sehr geehrte Frau" end r << " #{self.title}" if self.title.present? r << " #{self.lastname}" end return r end |
#gender_anrede ⇒ Object
90 91 92 93 94 95 96 |
# File 'app/models/user.rb', line 90 def gender_anrede if self.gender == true "Sehr geehrter Herr" else "Sehr geehrte Frau" end end |
#has_role?(name) ⇒ Boolean
63 64 65 66 67 68 69 |
# File 'app/models/user.rb', line 63 def has_role?(name) if name.class == Array (self.roles & Role.find_all_by_name(name)).any? else self.roles.include?(Role.find_by_name(name)) end end |
#title ⇒ Object
86 87 88 |
# File 'app/models/user.rb', line 86 def title "#{self.firstname} #{self.lastname} - #{self.email}" end |