Sha256: 3c07d8e15a22ff104440aa63de0bfde47daf72bfb647515ae97992c9e07673c4

Contents?: true

Size: 584 Bytes

Versions: 1

Compression:

Stored size: 584 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 -%>
<% if attributes.any?(&:password_digest?) -%>
  has_secure_password
<% end -%>
<% if attribute = attributes.detect{|a| a.name == 'position'} || attributes.detect{|a| a.name == 'name'} || attributes.detect{|a| a.name == 'title'} || attributes.first -%>

  scope :ordered, -> { order(:<%=attribute.name %>) }

<% end -%>
end
<% end -%>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_record_model_and_rspec_enhanced_templates-1.0.4 lib/templates/active_record/model/model.rb