<% module_namespacing do -%> class <%= class_name %> < <%= parent_class_name.classify %> <% attributes.select(&:reference?).each do |attribute| -%> belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %> <% end -%> <% attributes.select(&:attachment?).each do |attribute| -%> has_one_attached :<%= attribute.name %> <% end -%> <% attributes.select(&:attachments?).each do |attribute| -%> has_many_attached :<%= attribute.name %> <% end -%> def list_item_as_json mw_list_item(text: <%= attributes.first.name %>) end def display_as_json [ mw_display_text(label: 'ID', text: id.to_s), mw_display_text(label: 'Text', text: <%= attributes.first.name %>) ] end end <% end -%>