Sha256: 4ad06eef93fe2280031232640fddbf06f4a13e61ebc8c620a66879b314ef00ba

Contents?: true

Size: 743 Bytes

Versions: 21

Compression:

Stored size: 743 Bytes

Contents

<% 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 -%>

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
mobile_workflow-0.7.6 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.7.5 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.7.4 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.7.3 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.7.2 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.7.1 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.7.0 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.31 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.30 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.29 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.28 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.27 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.26 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.25 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.24 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.23 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.22 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.21 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.20 lib/generators/mobile_workflow/templates/model.rb.erb
mobile_workflow-0.6.19 lib/generators/mobile_workflow/templates/model.rb.erb