Sha256: 6c65b38bf04e6a2871624f28d0514c26186a26f20c105de579c2c99dde300e97
Contents?: true
Size: 660 Bytes
Versions: 82
Compression:
Stored size: 660 Bytes
Contents
require "traits/taggable" require "safe_html" class CuratedList include Mongoid::Document include Mongoid::Timestamps include Taggable stores_tags_for :sections field "slug", type: String has_and_belongs_to_many :artefacts, class_name: "Artefact" index "slug" GOVSPEAK_FIELDS = [] validates :slug, presence: true, uniqueness: true, slug: true validates_with SafeHtml def self.find_by_slug(slug) where(slug: slug).first end # Returns the artefacts in order, skipping missing artefacts def artefacts Artefact.where(:_id.in => artefact_ids).sort_by do |artefact| artefact_ids.index(artefact.id) end end end
Version data entries
82 entries across 82 versions & 1 rubygems