Sha256: ffe8c2f134faa902fa8c2b75e57110b177a2cc54e0f898e4bf9e984493deeaae

Contents?: true

Size: 350 Bytes

Versions: 21

Compression:

Stored size: 350 Bytes

Contents

class MongoDbDocument < ActiveRecord::Base
  has_many :comments, as: :commentable, dependent: :destroy
  
  validates :mongo_db_object_id, presence: true, uniqueness: { scope: :klass_name }
  validates :klass_name, presence: true
  validates :name, presence: true
  
  def mongo_db_object
    klass_name.constantize.find(mongo_db_object_id)
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
voluntary-0.7.1 app/models/mongo_db_document.rb
voluntary-0.7.0 app/models/mongo_db_document.rb
voluntary-0.6.0 app/models/mongo_db_document.rb
voluntary-0.5.2 app/models/mongo_db_document.rb
voluntary-0.5.1 app/models/mongo_db_document.rb
voluntary-0.5.0 app/models/mongo_db_document.rb
voluntary-0.4.0 app/models/mongo_db_document.rb
voluntary-0.3.0 app/models/mongo_db_document.rb
voluntary-0.2.4 app/models/mongo_db_document.rb
voluntary-0.2.3 app/models/mongo_db_document.rb
voluntary-0.2.2 app/models/mongo_db_document.rb
voluntary-0.2.1 app/models/mongo_db_document.rb
voluntary-0.2.0 app/models/mongo_db_document.rb
voluntary-0.1.0 app/models/mongo_db_document.rb
voluntary-0.1.0.rc4 app/models/mongo_db_document.rb
voluntary-0.1.0.rc3 app/models/mongo_db_document.rb
voluntary-0.1.0.rc2 app/models/mongo_db_document.rb
voluntary-0.1.0.rc1 app/models/mongo_db_document.rb
voluntary-0.0.3 app/models/mongo_db_document.rb
voluntary-0.0.2 app/models/mongo_db_document.rb