Sha256: 7a4c05a987c37bf1cb09ce6bee3f776dbe715dbf7f96962604c4f7b23fff1475
Contents?: true
Size: 1021 Bytes
Versions: 4
Compression:
Stored size: 1021 Bytes
Contents
class MessageTemplate < ActiveRecord::Base attr_accessible :status, :title, :body, :locale default_scope :order => "message_templates.position" has_many :message_requests validates_uniqueness_of :status validates_presence_of :status, :title, :body acts_as_list paginates_per 10 def embed_body(options = {}) template = Erubis::Eruby.new(body) context = { :library_group => LibraryGroup.site_config }.merge(options) template.evaluate(context) end def self.localized_template(status, locale) MessageTemplate.where(:status => status, :locale => locale).first || MessageTemplate.where(:status => status).first end end # == Schema Information # # Table name: message_templates # # id :integer not null, primary key # status :string(255) not null # title :text not null # body :text not null # position :integer # created_at :datetime # updated_at :datetime # locale :string(255) default("ja") #
Version data entries
4 entries across 4 versions & 1 rubygems