Sha256: e4e4dd809695478f33ec98ab5751f6561a699ee1757ea14544153a6da30fbab6

Contents?: true

Size: 567 Bytes

Versions: 10

Compression:

Stored size: 567 Bytes

Contents

module DataCatalog

  class Note

    include MongoMapper::Document

    # == Attributes

    key :text,      String
    key :user_id,   String
    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.8 examples/datacatalog/models/note.rb
sinatra_resource-0.4.7 examples/datacatalog/models/note.rb
sinatra_resource-0.4.6 examples/datacatalog/models/note.rb
sinatra_resource-0.4.5 examples/datacatalog/models/note.rb
sinatra_resource-0.4.4 examples/datacatalog/models/note.rb
sinatra_resource-0.4.3 examples/datacatalog/models/note.rb
sinatra_resource-0.4.2 examples/datacatalog/models/note.rb
sinatra_resource-0.4.1 examples/datacatalog/models/note.rb
sinatra_resource-0.4.0 examples/datacatalog/models/note.rb
sinatra_resource-0.3.6 examples/datacatalog/models/note.rb