gravier_app/app/models/politique_message.rb
2017-09-21 12:37:53 +02:00

36 lines
632 B
Ruby

class PolitiqueMessage < ActiveRecord::Base
belongs_to :politique_message_template
belongs_to :politique_departement
def mail_body
r = ""
r+= self.politique_message_template.message
r+= "\n\n"
r+= self.name.to_s
r+= " - "
r+= self.politique_departement.name if self.politique_departement
r
end
def emails
if self.politique_departement
self.politique_departement.emails.join(",")
else
""
end
end
def emails_with_space
if self.politique_departement
self.politique_departement.emails.join(", ")
else
""
end
end
end