Sha256: 4591813134d0dede8cfef5df7898c14e7ae1d3203484a1d5c79cdf33b53912b5

Contents?: true

Size: 827 Bytes

Versions: 17

Compression:

Stored size: 827 Bytes

Contents

class Ecm::Cms::Template < ActiveRecord::Base
  self.table_name = 'ecm_cms_templates'

  # add shared behaviour for database backed templates
  include Ecm::Cms::DatabaseTemplate
  
  # associations
  belongs_to :ecm_cms_folder,
             :class_name => 'Ecm::Cms::Folder',
             :foreign_key => 'ecm_cms_folder_id'

  # attributes
  attr_accessible :basename,
                  :body,
                  :ecm_cms_folder_id,
                  :format,
                  :handler,
                  :layout,
                  :locale,
                  :pathname

  # callbacks
  before_validation :ensure_basename_starts_without_underscore, :if => Proc.new { |t| t.basename.present? }

  private

  def ensure_basename_starts_without_underscore
    self.basename.slice!(0) if self.basename.start_with?('_')
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
ecm_cms-1.0.5.pre app/models/ecm/cms/template.rb
ecm_cms-1.0.4.pre app/models/ecm/cms/template.rb
ecm_cms-1.0.3.pre app/models/ecm/cms/template.rb
ecm_cms-1.0.2.pre app/models/ecm/cms/template.rb
ecm_cms-1.0.1.pre app/models/ecm/cms/template.rb
ecm_cms-1.0.0.pre app/models/ecm/cms/template.rb
ecm_cms-0.0.13.pre app/models/ecm/cms/template.rb
ecm_cms-0.0.11.pre app/models/ecm/cms/template.rb
ecm_cms-0.0.10.pre app/models/ecm/cms/template.rb
ecm_cms-0.0.8.pre app/models/ecm/cms/template.rb
ecm_cms-0.0.7.pre app/models/ecm/cms/template.rb
ecm_cms-0.0.6.pre app/models/ecm/cms/template.rb
ecm_cms-0.0.5.pre app/models/ecm/cms/template.rb
ecm_cms-0.0.4.pre app/models/ecm/cms/template.rb
ecm_cms-0.0.3.pre app/models/ecm/cms/template.rb
ecm_cms-0.0.2.pre app/models/ecm/cms/template.rb
ecm_cms-0.0.1.pre app/models/ecm/cms/template.rb