module Redactor2Rails::Orm::Mongoid::AssetBase::ClassMethods

Public Class Methods

extended(base) click to toggle source
# File lib/redactor2_rails/orm/mongoid.rb, line 13
def self.extended(base)
  base.class_eval do
    store_in collection: 'redactor2_assets'

    belongs_to :assetable, polymorphic: true

    field :data_file_name, type: String
    field :data_content_type, type: String
    field :data_file_size, type: Integer

    field :type, type: String

    field :width, type: Integer
    field :height, type: Integer

    index(assetable: 1, type: 1)
    index(assetable: 1)
  end
end