Sha256: 4a8a2b7eef5c702017035f1625943dbce07a7b3fd0e454c29397176e3f0e5ea5
Contents?: true
Size: 679 Bytes
Versions: 2
Compression:
Stored size: 679 Bytes
Contents
module Locomotive class Snippet include Locomotive::Mongoid::Document include Concerns::Shared::SiteScope include Concerns::Shared::Slug ## fields ## field :name field :slug field :template, localize: true ## validations ## validates_presence_of :name, :slug, :template validates_uniqueness_of :slug, scope: :site_id ## named scopes ## scope :by_id_or_slug, ->(id_or_slug) { where('$or' => [{ _id: id_or_slug }, { slug: id_or_slug }]) } ## behaviours ## slugify_from :name ## indexes ## index site_id: 1, slug: 1 ## methods ## def touch_site_attribute :template_version end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
locomotivecms-4.2.0.alpha2 | app/models/locomotive/snippet.rb |
locomotivecms-4.2.0.alpha1 | app/models/locomotive/snippet.rb |