Sha256: 3486e9e5097f119130b0e1912bdd8a0fb1a47ba7f21b3207eb702c45aebc122e
Contents?: true
Size: 1.03 KB
Versions: 7
Compression:
Stored size: 1.03 KB
Contents
class <%= class_name %> < ActiveRecord::Base <% if (string_attributes = attributes.map{ |attribute| attribute.name.to_sym if attribute.type.to_s =~ /string|text/ }.compact.uniq).any? %> acts_as_indexed :fields => <%= string_attributes.inspect %> validates <%= string_attributes.first.inspect %>, :presence => true, :uniqueness => true <% else %> # def title was created automatically because you didn't specify a string field # when you ran the refinery_engine generator. Love, Refinery CMS. def title "Override def title in vendor/engines/<%= plural_name %>/app/models/<%= singular_name %>.rb" end <% end -%> <% 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
7 entries across 7 versions & 1 rubygems