Sha256: 055139d218c3c0d4b4d5550a7397331340b5bfa927a6cc23b7e127f9aa652892

Contents?: true

Size: 630 Bytes

Versions: 5

Compression:

Stored size: 630 Bytes

Contents

# Model <%= class_name %> defines ... TODO:
#
<% 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

5 entries across 5 versions & 1 rubygems

Version Path
active_record_model_and_rspec_enhanced_templates-1.0.10 lib/templates/active_record/model/model.rb
active_record_model_and_rspec_enhanced_templates-1.0.9 lib/templates/active_record/model/model.rb
active_record_model_and_rspec_enhanced_templates-1.0.8 lib/templates/active_record/model/model.rb
active_record_model_and_rspec_enhanced_templates-1.0.6 lib/templates/active_record/model/model.rb
active_record_model_and_rspec_enhanced_templates-1.0.5 lib/templates/active_record/model/model.rb