Sha256: a40d5efa83ece2c44ff9b317dfec5054fbeb481211a8186e6d34b856ac469096

Contents?: true

Size: 542 Bytes

Versions: 92

Compression:

Stored size: 542 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? %><%= ', required: true' if attribute.required? %>
<% 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

92 entries across 92 versions & 7 rubygems

Version Path
activerecord-5.2.8.1 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-5.2.8 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-5.2.7.1 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-5.2.7 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-5.2.6.3 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-5.2.6.2 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-5.2.6.1 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-5.2.6 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-5.2.4.6 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-5.2.5 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-5.2.4.5 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-5.2.4.4 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-5.2.4.3 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-5.2.4.2 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-5.2.4.1 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-5.2.4 lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-5.2.4.rc1 lib/rails/generators/active_record/model/templates/model.rb.tt
spiral_form-0.1.1 vendor/bundle/gems/activerecord-5.2.3/lib/rails/generators/active_record/model/templates/model.rb.tt
spiral_form-0.1.0 vendor/bundle/gems/activerecord-5.2.3/lib/rails/generators/active_record/model/templates/model.rb.tt
activerecord-5.2.3 lib/rails/generators/active_record/model/templates/model.rb.tt