Class: VirtualUser

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.drop_domain_from_email_each(users) ⇒ Object



34
35
36
37
38
# File 'app/models/virtual_user.rb', line 34

def self.drop_domain_from_email_each(users)
  users.each do |user|
    user.email.sub!(/@.*/, '')
  end
end

Instance Method Details

#change_data(params) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'app/models/virtual_user.rb', line 24

def change_data(params)
  attrs = params.symbolize_keys
  if attrs[:password].blank?
    attrs.delete(:password)
    update_without_password(attrs)
  else
    update_attributes(attrs)
  end
end

#repair_email_formatObject



40
41
42
43
44
45
# File 'app/models/virtual_user.rb', line 40

def repair_email_format
  if self.email !~ /@.*$/
    self.email += "@#{self.virtual_domain.name}"
  end
  true
end