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