Sha256: b2c749e57005edf9ad7142b3276b82d50a24e8040df2542f6eedf7de73ff2415

Contents?: true

Size: 576 Bytes

Versions: 3

Compression:

Stored size: 576 Bytes

Contents

module DataCatalog

  class Note

    include MongoMapper::Document

    # == Attributes

    key :text,      String
    key :user_id,   Mongo::ObjectID
    timestamps!
  
    # == Indices

    # == Associations

    belongs_to :user, :class_name => 'DataCatalog::User'

    # == Validations

    validates_presence_of :text
    validates_presence_of :user_id

    validate :general_validation

    def general_validation
      if user.nil?
        errors.add(:user_id, "must be valid")
      end
    end

    # == Class Methods

    # == Various Instance Methods

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sinatra_resource-0.4.11 examples/datacatalog/models/note.rb
sinatra_resource-0.4.10 examples/datacatalog/models/note.rb
sinatra_resource-0.4.9 examples/datacatalog/models/note.rb