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