Sha256: 28d937e7091a050a97ad13ecaf9c5cfe464b5b963b2e6b4a2b02e4a4060a4adc
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
<% module_namespacing do -%> # frozen_string_literal: true # Model class for <%= plural_table_name %> table class <%= class_name %> < <%= parent_class_name.classify %> include HagridChassis::MultiTenant include HagridChassis::Audited <% attributes.select(&:reference?).each do |attribute| -%> belongs_to :<%= attribute.name %><%= ", polymorphic: true" if attribute.polymorphic? %> <% end -%> <% attributes.select(&:rich_text?).each do |attribute| -%> has_rich_text :<%= attribute.name %> <% 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 -%> <% attributes.select(&:token?).each do |attribute| -%> has_secure_token<% if attribute.name != "token" %> :<%= attribute.name %><% end %> <% end -%> <% if attributes.any?(&:password_digest?) -%> has_secure_password <% end -%> effective_resource do <% attributes.each do |attribute| -%><%= " #{attribute.name} :#{attribute.type}\n" unless attribute.type == :references %><% end -%> end end <% end -%>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
five-two-nw-olivander-0.1.2.43.a | lib/generators/olivander/active_record/model/templates/model.rb.tt |