Sha256: 7ee9c82add51b77111716f6022bdf0d2b6c5535608691ec79279975f508b5340

Contents?: true

Size: 831 Bytes

Versions: 84

Compression:

Stored size: 831 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(&: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 -%>
end
<% end -%>

Version data entries

84 entries across 81 versions & 9 rubygems

Version Path
omg-activerecord-8.0.0.alpha8 lib/rails/generators/active_record/model/templates/model.rb.tt
omg-activerecord-8.0.0.alpha7 lib/rails/generators/active_record/model/templates/model.rb.tt
omg-activerecord-8.0.0.alpha4 lib/rails/generators/active_record/model/templates/model.rb.tt
omg-activerecord-8.0.0.alpha3 lib/rails/generators/active_record/model/templates/model.rb.tt
omg-activerecord-8.0.0.alpha2 lib/rails/generators/active_record/model/templates/model.rb.tt
omg-activerecord-8.0.0.alpha1 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-7.1.4 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-7.2.1 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-7.2.0 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-7.2.0.rc1 lib/rails/generators/active_record/model/templates/model.rb.tt
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8.4/lib/rails/generators/active_record/model/templates/model.rb.tt
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.3.4/lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-7.2.0.beta3 lib/rails/generators/active_record/model/templates/model.rb.tt
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.5.1/lib/rails/generators/active_record/model/templates/model.rb.tt
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.5.1/lib/rails/generators/active_record/model/templates/model.rb.tt
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.5.1/lib/rails/generators/active_record/model/templates/model.rb.tt
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.3.4/lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-7.2.0.beta2 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-7.1.3.4 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-7.0.8.4 lib/rails/generators/active_record/model/templates/model.rb.tt