Sha256: 0d315fb9c65be8ae56eb03487e9e6f47d22ffe5862de39ffb30dfebc2246a7e0
Contents?: true
Size: 1.15 KB
Versions: 99
Compression:
Stored size: 1.15 KB
Contents
require "edition" class LicenceEdition < Edition field :licence_identifier, :type => String field :licence_short_description, :type => String field :licence_overview, :type => String field :will_continue_on, :type => String field :continuation_link, :type => String GOVSPEAK_FIELDS = Edition::GOVSPEAK_FIELDS + [:licence_overview] validates :licence_identifier, :presence => true validate :licence_identifier_unique validates_format_of :continuation_link, :with => URI::regexp(%w(http https)), :allow_blank => true @fields_to_clone = [:licence_identifier, :licence_short_description, :licence_overview, :will_continue_on, :continuation_link] def whole_body [licence_short_description, licence_overview].join("\n\n") end def indexable_content "#{super} #{licence_short_description} #{Govspeak::Document.new(licence_overview).to_text}".strip end private def licence_identifier_unique if self.class.without_state('archived').where(:licence_identifier => licence_identifier, :panopticon_id.ne => panopticon_id).any? errors.add(:licence_identifier, :taken) end end end
Version data entries
99 entries across 99 versions & 1 rubygems