Sha256: 438fdfa43b87121ec77f27288a260e3c5f0a36053fd755fd7fef996da532ac2e

Contents?: true

Size: 359 Bytes

Versions: 3

Compression:

Stored size: 359 Bytes

Contents

module Popolo
  # A URL.
  class Link
    include Mongoid::Document

    embedded_in :linkable, polymorphic: true

    # A URL.
    field :url, type: String
    # A note, e.g. 'Wikipedia page'.
    field :note, type: String

    validates_presence_of :url
    # @note Add URL validation to match JSON Schema?

    def to_s
      note || url
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
popolo-0.1.1 app/models/popolo/link.rb
popolo-0.1.0 app/models/popolo/link.rb
popolo-0.0.3 app/models/popolo/link.rb