Sha256: bcd9e5a7b08301211bb2634c9f09a366ed7660031a447356992b42c57a828031

Contents?: true

Size: 674 Bytes

Versions: 15

Compression:

Stored size: 674 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)]
  end

end
<% end -%>

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
mobile_workflow-0.5.11 lib/templates/active_record/model/model.rb.erb
mobile_workflow-0.5.10 lib/templates/active_record/model/model.rb.erb
mobile_workflow-0.5.9 lib/templates/active_record/model/model.rb.erb
mobile_workflow-0.5.8 lib/templates/active_record/model/model.rb.erb
mobile_workflow-0.5.7 lib/templates/active_record/model/model.rb.erb
mobile_workflow-0.5.6 lib/templates/active_record/model/model.rb.erb
mobile_workflow-0.5.5 lib/templates/active_record/model/model.rb.erb
mobile_workflow-0.5.4 lib/templates/active_record/model/model.rb.erb
mobile_workflow-0.5.3 lib/templates/active_record/model/model.rb.erb
mobile_workflow-0.5.2 lib/templates/active_record/model/model.rb.erb
mobile_workflow-0.5.1 lib/templates/active_record/model/model.rb.erb
mobile_workflow-0.5.0 lib/templates/active_record/model/model.rb.erb
mobile_workflow-0.4.0 lib/templates/active_record/model/model.rb.erb
mobile_workflow-0.3.1 lib/templates/active_record/model/model.rb.erb
mobile_workflow-0.2.0 lib/templates/active_record/model/model.rb.erb