Sha256: 9eb455baee54566014757d373499c99ce8c00c244bd1a85b858ab51452fb2adc
Contents?: true
Size: 804 Bytes
Versions: 14
Compression:
Stored size: 804 Bytes
Contents
class <%= class_name %> < ActiveRecord::Base acts_as_indexed :fields => [:<%= attributes.collect{ |attribute| attribute.name if attribute.type.to_s =~ /string|text/ }.compact.uniq.join(", :") %>], :index_file => [Rails.root.to_s, "tmp", "index"] validates_presence_of :<%= attributes.first.name %> validates_uniqueness_of :<%= attributes.first.name %> <% attributes.collect{|a| a if a.type.to_s == 'image'}.compact.uniq.each do |a| -%> belongs_to :<%= a.name.gsub("_id", "") %><%= ", :class_name => 'Image'" unless a.name =~ /^image(_id)?$/ %> <% end -%> <% attributes.collect{|a| a if a.type.to_s == 'resource'}.compact.uniq.each do |a| -%> belongs_to :<%= a.name.gsub("_id", "") %><%= ", :class_name => 'Resource'" unless a.name =~ /^resource(_id)?$/ %> <% end -%> end
Version data entries
14 entries across 14 versions & 1 rubygems