Class: AdminUser
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- AdminUser
- Defined in:
- app/models/admin_user.rb
Instance Attribute Summary collapse
-
#password_confirmation ⇒ Object
Returns the value of attribute password_confirmation.
Instance Method Summary collapse
- #be_super! ⇒ Object
- #build_domain(params) ⇒ Object
- #change_data(params) ⇒ Object
- #domain(id) ⇒ Object
- #domains ⇒ Object
Instance Attribute Details
#password_confirmation ⇒ Object
Returns the value of attribute password_confirmation.
11 12 13 |
# File 'app/models/admin_user.rb', line 11 def password_confirmation @password_confirmation end |
Instance Method Details
#be_super! ⇒ Object
23 24 25 |
# File 'app/models/admin_user.rb', line 23 def be_super! self.super = true end |
#build_domain(params) ⇒ Object
39 40 41 42 43 |
# File 'app/models/admin_user.rb', line 39 def build_domain(params) domain = self.virtual_domains.build domain[:name] = params[:name] domain end |
#change_data(params) ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'app/models/admin_user.rb', line 46 def change_data(params) attrs = params.symbolize_keys if attrs[:password].blank? attrs.delete(:password) update_without_password(attrs) else update_with_password(attrs) end end |
#domain(id) ⇒ Object
35 36 37 |
# File 'app/models/admin_user.rb', line 35 def domain(id) (self.super == true ? VirtualDomain : self.virtual_domains).find(id) end |
#domains ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/models/admin_user.rb', line 27 def domains vd = self.super == true ? VirtualDomain.all : self.virtual_domains vd.each do |domain| VirtualUser.drop_domain_from_email_each(domain.virtual_users) end vd end |