Sha256: 4b478d3eea40c9352f0c5fec5dc757c7f52763b9e796d3d4a2c197086abbe8cd

Contents?: true

Size: 539 Bytes

Versions: 4

Compression:

Stored size: 539 Bytes

Contents

class Ecm::Cms::Template < ActiveRecord::Base
  # 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'

  # 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

4 entries across 4 versions & 1 rubygems

Version Path
ecm_cms2-1.1.1 app/models/ecm/cms/template.rb
ecm_cms2-1.1.0 app/models/ecm/cms/template.rb
ecm_cms2-1.0.1 app/models/ecm/cms/template.rb
ecm_cms2-1.0.0 app/models/ecm/cms/template.rb