Sha256: 61252187a131f27a3b4b91db1e41521cc988b7965bf9de783bc674ff9e02b3cb

Contents?: true

Size: 433 Bytes

Versions: 11

Compression:

Stored size: 433 Bytes

Contents

module DataCatalog
  
  class Source

    include MongoMapper::Document

    # == Attributes

    key :title, String
    key :url,   String
    key :raw,   Hash
    timestamps!

    # == Indices

    ensure_index :url

    # == Associations

    many :categorizations

    def categories
      categorizations.map(&:category)
    end

    # == Validations

    validates_presence_of :title
    validates_presence_of :url

  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sinatra_resource-0.3.2 examples/datacatalog/models/source.rb
sinatra_resource-0.3.1 examples/datacatalog/models/source.rb
sinatra_resource-0.3.0 examples/datacatalog/models/source.rb
sinatra_resource-0.2.6 examples/datacatalog/models/source.rb
sinatra_resource-0.2.5 examples/datacatalog/models/source.rb
sinatra_resource-0.2.4 examples/datacatalog/models/source.rb
sinatra_resource-0.2.3 examples/datacatalog/models/source.rb
sinatra_resource-0.2.2 examples/datacatalog/models/source.rb
sinatra_resource-0.2.1 examples/datacatalog/models/source.rb
sinatra_resource-0.2.0 examples/datacatalog/models/source.rb
sinatra_resource-0.1.0 examples/datacatalog/models/source.rb