Class: Ressbo::Email

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/ressbo/models/email.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_address_book(email) ⇒ Object



34
35
36
# File 'lib/ressbo/models/email.rb', line 34

def self.from_address_book (email)
  record = new(:address => email.value)
end

.mutt_query(query) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/ressbo/models/email.rb', line 39

def self.mutt_query (query)
  query = "%#{query.downcase}%"
  conditions = ["LOWER(people.first_name) LIKE ?", query]
  conditions.first << " OR LOWER(people.last_name) LIKE ?"
  conditions << query
  conditions.first << " OR LOWER(emails.address) LIKE ?"
  conditions << query
  
  find(:all, :include => :person, :conditions => conditions)
end

Instance Method Details

#to_muttObject



51
52
53
# File 'lib/ressbo/models/email.rb', line 51

def to_mutt
  "#{address}\t#{person.name}"
end