Sha256: 52d10c0bf74a3dcd9756bd291f6a1daaf018f485101abc0324acf082b9b2c18a
Contents?: true
Size: 1.12 KB
Versions: 19
Compression:
Stored size: 1.12 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 = [: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
19 entries across 19 versions & 1 rubygems