orbit-basic/app/models/announcement.rb

22 lines
457 B
Ruby

class Announcement
include MongoMapper::Document
key :title_en, String
key :title_zh_tw, String
key :content_en, String
key :content_zh_tw, String
def to_liquid
{ "id" => self.id, "title" => self.send("title_#{I18n.locale}"), "content" => self.send("content_#{I18n.locale}") }
end
def title
self.send("title_#{I18n.locale}")
end
def content
self.send("content_#{I18n.locale}")
end
end