Module: ReaderUser::InstanceMethods

Defined in:
lib/reader_user.rb

Instance Method Summary collapse

Instance Method Details

#update_readerObject



18
19
20
21
22
23
24
25
# File 'lib/reader_user.rb', line 18

def update_reader
  if !new_record? && self.reader && !self.skip_reader_update
    changed_columns = Reader.user_columns & self.changed
    att = self.attributes.slice(*changed_columns)
    self.reader.send :update_with, att if att.any?
  end
  true
end

#update_with(att) ⇒ Object



27
28
29
30
31
32
# File 'lib/reader_user.rb', line 27

def update_with(att)
  self.skip_reader_update = true
  self.confirm_password = false
  self.update_attributes(att)
  self.skip_reader_update = false
end