Sha256: 358a775ebdc6609f3e5af2c067aa22f709973dd8f07278a6a81202e25e9baf21

Contents?: true

Size: 504 Bytes

Versions: 14

Compression:

Stored size: 504 Bytes

Contents

module DataCatalog

  class Categorization

    include MongoMapper::Document

    # == Attributes

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

    # == Indices

    # == Associations

    belongs_to :source
    belongs_to :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

14 entries across 14 versions & 1 rubygems

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