Sha256: df8ca0c2ac6aa75e7fe41bf576d95e40d1a9dabd96898ec6690f274d65f0801e

Contents?: true

Size: 569 Bytes

Versions: 10

Compression:

Stored size: 569 Bytes

Contents

module DataCatalog

  class Note

    include MongoMapper::Document

    # == Attributes

    key :text,      String
    key :user_id,   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

10 entries across 10 versions & 1 rubygems

Version Path
sinatra_resource-0.4.21 examples/datacatalog/models/note.rb
sinatra_resource-0.4.20 examples/datacatalog/models/note.rb
sinatra_resource-0.4.19 examples/datacatalog/models/note.rb
sinatra_resource-0.4.18 examples/datacatalog/models/note.rb
sinatra_resource-0.4.17 examples/datacatalog/models/note.rb
sinatra_resource-0.4.16 examples/datacatalog/models/note.rb
sinatra_resource-0.4.15 examples/datacatalog/models/note.rb
sinatra_resource-0.4.14 examples/datacatalog/models/note.rb
sinatra_resource-0.4.13 examples/datacatalog/models/note.rb
sinatra_resource-0.4.12 examples/datacatalog/models/note.rb