Sha256: 730553584898918612a226968c58afe9a5ed1fb4447aed0962c414a06316d586

Contents?: true

Size: 784 Bytes

Versions: 14

Compression:

Stored size: 784 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: <%= 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 -%>

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mobile_workflow-0.6.17 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.16 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.15 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.14 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.13 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.12 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.11 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.10 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.9 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.8 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.7 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.6 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.4 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.3 lib/generators/mobile_workflow/templates/model.rb.erb