Sha256: 56fd174e7c5c6d2f4ac1f69df5f2cccf2b95b9b601c51781460ce368e431f0fa

Contents?: true

Size: 590 Bytes

Versions: 1

Compression:

Stored size: 590 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 -%>

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
refinerycms-0.9.6.18 vendor/plugins/refinery/lib/generators/refinery/templates/model.rb