Sha256: c319a28f0f77268b48d6ee300d594f735b1abd3d49e5fa7f00742e7af639d6d5
Contents?: true
Size: 970 Bytes
Versions: 1
Compression:
Stored size: 970 Bytes
Contents
# Model <%= class_name %> defines ... TODO: # <% module_namespacing do -%> class <%= class_name %> < <%= parent_class_name.classify %> <% if attributes.any?(&:reference?) -%> <% attributes.select(&:reference?).each do |attribute| -%> belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %><%= ', required: true' if attribute.required? %> <% end -%> <% end -%> <% if attributes.first.respond_to?(:token) and attributes.any?(&:token?) -%> <% attributes.select(&:token?).each do |attribute| -%> has_secure_token<% if attribute.name != "token" %> :<%= attribute.name %><% end %> <% end -%> <% 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.1.2 | lib/templates/active_record/model/model.rb |