Sha256: 05030d6b95abebb84a851887100f4fb6abdd301280c1a28635378db0a916a065

Contents?: true

Size: 650 Bytes

Versions: 17

Compression:

Stored size: 650 Bytes

Contents

class LiquidTemplate
  
  include Locomotive::Mongoid::Document
  
  ## fields ##
  field :name
  field :slug
  field :value
  
  ## associations ##
  belongs_to_related :site
  
  ## callbacks ##
  before_validate :normalize_slug
  
  ## validations ##
  validates_presence_of   :site, :name, :slug, :value
  validates_uniqueness_of :slug, :scope => :site_id
  
  ## behaviours ##
  liquify_template :value
  
  ## methods ##
    
  protected
  
  def normalize_slug
    self.slug = self.name.clone if self.slug.blank? && self.name.present?
    self.slug.slugify!(:without_extension => true, :downcase => true) if self.slug.present?
  end
      
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
locomotive_cms-0.0.3.3 app/models/liquid_template.rb
locomotive_cms-0.0.3.1 app/models/liquid_template.rb
locomotive_cms-0.0.2.9 app/models/liquid_template.rb
locomotive_cms-0.0.2.8 app/models/liquid_template.rb
locomotive_cms-0.0.2.7 app/models/liquid_template.rb
locomotive_cms-0.0.2.6 app/models/liquid_template.rb
locomotive_cms-0.0.2.5 app/models/liquid_template.rb
locomotive_cms-0.0.2.4 app/models/liquid_template.rb
locomotive_cms-0.0.2.3 app/models/liquid_template.rb
locomotive_cms-0.0.2.2 app/models/liquid_template.rb
locomotive_cms-0.0.2.1 app/models/liquid_template.rb
locomotive_cms-0.0.2 app/models/liquid_template.rb
locomotive_cms-0.0.1.4 app/models/liquid_template.rb
locomotive_cms-0.0.1.3 app/models/liquid_template.rb
locomotive_cms-0.0.1.2 app/models/liquid_template.rb
locomotive_cms-0.0.1.1 app/models/liquid_template.rb
locomotive_cms-0.0.1 app/models/liquid_template.rb