validates_inclusion_of :message_read, :in => [ true, false ]
validates_as_utf8 :title
- attr_accessible :title, :body
-
- after_initialize :set_defaults
-
def self.from_mail(mail, from, to)
if mail.multipart?
if mail.text_part
body = mail.decoded
end
- message = Message.new({
+ message = Message.new(
:sender => from,
:recipient => to,
:sent_on => mail.date.new_offset(0),
:title => mail.subject.sub(/\[OpenStreetMap\] */, ""),
:body => body,
:body_format => "text"
- }, :without_protection => true)
+ )
end
def body
md5 << body
md5.hexdigest
end
-
-private
-
- def set_defaults
- self.body_format = "markdown" unless self.attribute_present?(:body_format)
- end
end