Sha256: fa6725053684a210fbf1bf1f0bc7567ecc6014e7f848150aee7f948675c30236
Contents?: true
Size: 610 Bytes
Versions: 34
Compression:
Stored size: 610 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" validates :slug, presence: true, uniqueness: true, slug: true 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
34 entries across 34 versions & 1 rubygems