draper/lib/generators/rails/templates/decorator.rb

20 lines
509 B
Ruby

<%- module_namespacing do -%>
<%- if parent_class_name.present? -%>
class <%= class_name %>Decorator < <%= parent_class_name %>
<%- else -%>
class <%= class_name %>
<%- end -%>
delegate_all
# Define presentation-specific methods here. Helpers are accessed through
# `helpers` (aka `h`). You can override attributes, for example:
#
# def created_at
# helpers.content_tag :span, class: 'time' do
# object.created_at.strftime("%a %m/%d/%y")
# end
# end
end
<% end -%>