Sha256: 4f733ce95dc6bb6ad8e4cc82eaa7c6a8f2baeef75123489f5d6ddc2635f2ebdb
Contents?: true
Size: 807 Bytes
Versions: 16
Compression:
Stored size: 807 Bytes
Contents
class CMS::<%= @name %> < ActiveRecord::Base self.table_name = '<%= @name.collection %>' <% @type.attributes.select {|attr| attr.reference? }.each do |attribute| -%> belongs_to :<%= attribute.name %>, class_name: 'CMS::<%= attribute.reference_to %>' <% end -%> <% if @type.references.any? -%> <% @type.references.each do |type| -%> has_many :<%= type.model_name.collection %>, class_name: 'CMS::<%= type %>' <% end -%> <% end -%> attr_accessible <%= @type.accessible_attributes.map {|a| ":#{a.field_name}" }.sort.join(', ') %> <% if @type.orderable? -%> include CMS::Orderable orderable(:<%= @type.order_attribute.name %>) <% end -%> <% @type.file_attributes.each do |attribute| -%> mount_uploader :<%= attribute.name %>, CMS::Uploader <% end -%> def self.name '<%= @name %>' end end
Version data entries
16 entries across 16 versions & 1 rubygems