Sha256: 8748ffb7b0de8cfffb4f3a75e14c786719ff15daaafd75717ae454c16071dafe

Contents?: true

Size: 584 Bytes

Versions: 10

Compression:

Stored size: 584 Bytes

Contents

module DataCatalog

  class Categorization

    include MongoMapper::Document

    # == Attributes

    key :source_id,   String
    key :category_id, String
    timestamps!

    # == Indices

    # == Associations

    belongs_to :source,   :class_name => 'DataCatalog::Source'
    belongs_to :category, :class_name => 'DataCatalog::Category'

    # == Validations
    
    validate :validate_associations

    def validate_associations
      errors.add(:source_id, "must be valid") if source.nil?
      errors.add(:category_id, "must be valid") if category.nil?
    end

  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sinatra_resource-0.4.8 examples/datacatalog/models/categorization.rb
sinatra_resource-0.4.7 examples/datacatalog/models/categorization.rb
sinatra_resource-0.4.6 examples/datacatalog/models/categorization.rb
sinatra_resource-0.4.5 examples/datacatalog/models/categorization.rb
sinatra_resource-0.4.4 examples/datacatalog/models/categorization.rb
sinatra_resource-0.4.3 examples/datacatalog/models/categorization.rb
sinatra_resource-0.4.2 examples/datacatalog/models/categorization.rb
sinatra_resource-0.4.1 examples/datacatalog/models/categorization.rb
sinatra_resource-0.4.0 examples/datacatalog/models/categorization.rb
sinatra_resource-0.3.6 examples/datacatalog/models/categorization.rb