Class: MessageTemplate

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.localized_template(status, locale) ⇒ Object



23
24
25
# File 'app/models/message_template.rb', line 23

def self.localized_template(status, locale)
  MessageTemplate.where(:status => status, :locale => locale).first || MessageTemplate.where(:status => status).first
end

.per_pageObject



11
12
13
# File 'app/models/message_template.rb', line 11

def self.per_page
  10
end

Instance Method Details

#embed_body(options = {}) ⇒ Object



15
16
17
18
19
20
21
# File 'app/models/message_template.rb', line 15

def embed_body(options = {})
  template = Erubis::Eruby.new(body)
  context = {
    :library_group => LibraryGroup.site_config
  }.merge(options)
  template.evaluate(context)
end