Sha256: 8f9035894b666afa5e4e720f134225b4dae1cdcf9ac561c050efe504ba0e8924

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

<% module_namespacing do -%>
# <%= class_name %> Model
class <%= class_name %> < ApplicationRecord
  include ActivityHistory
  include CloneRecord
  include Uploadable
  include Downloadable
  include Sortable
  include Searchable
  <%- attributes.each do |attribute| -%>
    <%- if @singular_attachments.include?(attribute.name) -%>
  mount_uploader :<%=attribute.name%>, AttachmentUploader
    <%- elsif @plural_attachments.include?(attribute.name) -%>
  mount_uploaders :<%=attribute.name%>, AttachmentUploader
    <%- end -%>
    <%- if attribute.reference? -%>
  belongs_to :<%= attribute.name %>
    <%- end -%>
  <%- end -%>
  acts_as_list
  acts_as_paranoid
  # Begin validations area (don't delete)
  # End validations area (don't delete

  def self.index_attributes
    %i[<%= attributes.select { |k,v| @singular_attachments.exclude?(k) && @plural_attachments.exclude?(k) && %w[string text integer].include?(v) && %w[position].exclude?(k) && k.exclude?('-') }.map(&:first).join(' ') -%>]
  end
end
<% end -%>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
keppler-2.1.22 installer/core/rockets/keppler_capsules/lib/generators/keppler_capsule_scaffold/templates/models/model.rb
keppler-2.1.21 installer/core/rockets/keppler_capsules/lib/generators/keppler_capsule_scaffold/templates/models/model.rb
keppler-2.1.20 installer/core/rockets/keppler_capsules/lib/generators/keppler_capsule_scaffold/templates/models/model.rb
keppler-2.1.19 installer/core/rockets/keppler_capsules/lib/generators/keppler_capsule_scaffold/templates/models/model.rb