Sha256: 50c5bfb0bb2ceede7d9c3ee2e2fc9ba617c131dee29c396d923f80ef7c5abb09

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

<% module_namespacing do -%>
class <%= class_name %> < <%= parent_class_name.classify %>
  # == Constants ============================================================

  # == Attributes ===========================================================
<% 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 -%>

  # == Extensions ===========================================================

  # == Relationships ========================================================
<% attributes.select(&:reference?).each do |attribute| -%>
  belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %><%= ', required: true' if attribute.required? %>
<% end -%>

  # == Validations ==========================================================

  # == Scopes ===============================================================

  # == Callbacks ============================================================

  # == Class Methods ========================================================

  # == Instance Methods =====================================================

end
<% end -%>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
better_record-0.8.2 lib/templates/active_record/model/model.rb
better_record-0.8.1 lib/templates/active_record/model/model.rb