engine/app/presenters/locomotive/snippet_presenter.rb

20 lines
410 B
Ruby
Raw Normal View History

2011-12-05 12:29:58 +00:00
module Locomotive
class SnippetPresenter < BasePresenter
delegate :name, :slug, :template, :to => :source
def updated_at
I18n.l(self.source.updated_at, :format => :short)
end
2011-12-05 12:29:58 +00:00
def included_methods
super + %w(name slug template updated_at)
2011-12-05 12:29:58 +00:00
end
def as_json_for_html_view
methods = included_methods.clone - %w(template)
self.as_json(methods)
end
2011-12-05 12:29:58 +00:00
end
end