app/presenters/locomotive/snippet_presenter.rb in locomotive_cms-2.0.0.rc12 vs app/presenters/locomotive/snippet_presenter.rb in locomotive_cms-2.0.0

- old
+ new

@@ -1,20 +1,22 @@ module Locomotive class SnippetPresenter < BasePresenter - delegate :name, :slug, :template, :to => :source + ## properties ## + properties :name, :slug, :template + property :updated_at, only_getter: true + + ## other getters / setters ## + def updated_at - I18n.l(self.source.updated_at, :format => :short) + I18n.l(self.__source.updated_at, format: :short) end - def included_methods - super + %w(name slug template updated_at) - end + ## custom as_json ## def as_json_for_html_view - methods = included_methods.clone - %w(template) - self.as_json(methods) + self.as_json(self.getters - %w(template)) end end -end \ No newline at end of file +end