Sha256: 58fc26a3123b4cd167fea22cc38f873ba0135c09139828c9c5342ec8ce357821
Contents?: true
Size: 652 Bytes
Versions: 39
Compression:
Stored size: 652 Bytes
Contents
class <%= class_name %> < ActiveRecord::Base # Scopes, attachments, etc. has_history <% unless attributes.select{|a| a.name == 'list_order' }.empty? -%> include Tenon::Reorderable default_scope { order('<%= table_name %>.list_order') } <% end -%> <% attributes.select {|a| a.type.to_s == 'asset'}.each do |f| -%> has_asset :<%= f.name %> <% end -%> # Validations # Relationships <% attributes.select(&:reference?).each do |attribute| -%> belongs_to :<%= attribute.name %> <% end -%> <% attributes.select {|a| a.name.match(/_id$/)}.each do |attribute| -%> belongs_to :<%= attribute.name.gsub(/_id$/, '') %> <% end -%> private end
Version data entries
39 entries across 39 versions & 1 rubygems