Sha256: 005b0d2b3eade6c83d20f2008de210ad03ba6e832abeeaf1c2949491066557a3

Contents?: true

Size: 736 Bytes

Versions: 3

Compression:

Stored size: 736 Bytes

Contents

<% module_namespacing do -%>
class <%= class_name %> < <%= parent_class_name.classify %>
  include MobileWorkflow::Displayable
  
<% 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: text)
  end
  
  def display_as_json
    [
      mw_display_text(label: 'ID', text: id.to_s),
      mw_display_text(label: 'Text', text: text)
    ]
  end

end
<% end -%>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mobile_workflow-0.6.2 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.1 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.0 lib/generators/mobile_workflow/templates/model.rb.erb