Class: Contact

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Localized
Defined in:
lib/generators/fullstack/contacts/templates/app/models/contact.rb

Instance Method Summary collapse

Instance Method Details

#nameObject



14
15
16
# File 'lib/generators/fullstack/contacts/templates/app/models/contact.rb', line 14

def name
  [first_name, second_name].compact.join(" ")
end

#read!Object



35
36
37
38
39
# File 'lib/generators/fullstack/contacts/templates/app/models/contact.rb', line 35

def read!
  unless read?
    update_attributes!(:read => true)      
  end
end

#unread!Object



41
42
43
44
45
# File 'lib/generators/fullstack/contacts/templates/app/models/contact.rb', line 41

def unread!
  unless unread?
    update_attributes!(:read => false)
  end
end

#unread?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/generators/fullstack/contacts/templates/app/models/contact.rb', line 18

def unread?
  !read?
end