Class: Email

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

Overview

Copyright © 2008-2013 Michael Dvorkin and contributors.

Fat Free CRM is freely distributable under the terms of MIT license. See MIT-LICENSE file or www.opensource.org/licenses/mit-license.php


Schema Information

Table name: emails

id              :integer         not null, primary key
imap_message_id :string(255)     not null
user_id         :integer
mediator_id     :integer
mediator_type   :string(255)
sent_from       :string(255)     not null
sent_to         :string(255)     not null
cc              :string(255)
bcc             :string(255)
subject         :string(255)
body            :text
header          :text
sent_at         :datetime
received_at     :datetime
deleted_at      :datetime
created_at      :datetime
updated_at      :datetime
state           :string(16)      default("Expanded"), not null

Instance Method Summary collapse

Instance Method Details

#bodyObject



45
46
47
# File 'app/models/polymorphic/email.rb', line 45

def body
  super
end

#body_with_textileObject



49
50
51
52
53
54
55
# File 'app/models/polymorphic/email.rb', line 49

def body_with_textile
  if defined?(RedCloth)
    RedCloth.new(body_without_textile).to_html
  else
    body_without_textile.to_s.gsub("\n", "<br/>")
  end
end

#collapsed?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/models/polymorphic/email.rb', line 41

def collapsed?
  state == "Collapsed"
end

#expanded?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'app/models/polymorphic/email.rb', line 37

def expanded?
  state == "Expanded"
end