Sha256: 81ab3ffa1e01ed792715c2f4e5ade1287add62786c1633e921cb0fcb48df68d1

Contents?: true

Size: 1.22 KB

Versions: 16

Compression:

Stored size: 1.22 KB

Contents

<% 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

16 entries across 16 versions & 1 rubygems

Version Path
better_record-0.8.0 lib/templates/active_record/model/model.rb
better_record-0.7.5 lib/templates/active_record/model/model.rb
better_record-0.7.4 lib/templates/active_record/model/model.rb
better_record-0.7.3 lib/templates/active_record/model/model.rb
better_record-0.7.2 lib/templates/active_record/model/model.rb
better_record-0.7.1 lib/templates/active_record/model/model.rb
better_record-0.7.0 lib/templates/active_record/model/model.rb
better_record-0.6.1 lib/templates/active_record/model/model.rb
better_record-0.6.0 lib/templates/active_record/model/model.rb
better_record-0.5.5 lib/templates/active_record/model/model.rb
better_record-0.5.4 lib/templates/active_record/model/model.rb
better_record-0.5.1 lib/templates/active_record/model/model.rb
better_record-0.5.0 lib/templates/active_record/model/model.rb
better_record-0.4.0 lib/templates/active_record/model/model.rb
better_record-0.3.0 lib/templates/active_record/model/model.rb
better_record-0.2.0 spec/dummy/lib/templates/active_record/model/model.rb