cirandas.net

ref: master

app/models/contact_list.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class ContactList < ApplicationRecord

  serialize :list, Array

  def list
    self[:list] || []
  end

  def data
    if self.fetched
      { "fetched" => true, "contact_list" => self.id, "error" => self.error_fetching }
    else
      {}
    end
  end

  def register_auth_error
    msg = _('There was an error while authenticating. Did you enter correct login and password?')
    self.fetched = true
    self.error_fetching = msg
    self.save!
  end

  def register_error
    msg = _('There was an error while looking for your contact list. Please, try again')
    self.fetched = true
    self.error_fetching = msg
    self.save!
  end

end