Sha256: 42d74e0e6a089dd2dbe7f88ddee09904e35606c6526fa308e412470c91712e2f

Contents?: true

Size: 524 Bytes

Versions: 7

Compression:

Stored size: 524 Bytes

Contents

module Adminpanel
  class <%= camelized_resource -%> < ActiveRecord::Base
    include Adminpanel::Base

    <%= associations if has_associations? -%>

<% if needs_name? -%>
    def name
      self.id.to_s
    end
<% end -%>

    def self.form_attributes
      [
<%= indent(get_attribute_hash, 8) + "," %>
<%= indent(file_field_form_hash, 8) if has_gallery? %>
      ]
    end

    def self.display_name
      '<%= camelized_resource %>' #singular
    end

    # def self.icon
    #   "truck" # fa-{icon}
    # end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
adminpanel-2.6.0 lib/generators/adminpanel/resource/templates/adminpanel_resource_template.rb
adminpanel-2.5.5 lib/generators/adminpanel/resource/templates/adminpanel_resource_template.rb
adminpanel-2.5.4 lib/generators/adminpanel/resource/templates/adminpanel_resource_template.rb
adminpanel-2.5.3 lib/generators/adminpanel/resource/templates/adminpanel_resource_template.rb
adminpanel-2.5.2 lib/generators/adminpanel/resource/templates/adminpanel_resource_template.rb
adminpanel-2.5.1 lib/generators/adminpanel/resource/templates/adminpanel_resource_template.rb
adminpanel-2.5.0 lib/generators/adminpanel/resource/templates/adminpanel_resource_template.rb