Module: RedactorRails::Orm::Mongoid::AssetBase::ClassMethods

Defined in:
lib/redactor-rails/orm/mongoid.rb

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/redactor-rails/orm/mongoid.rb', line 13

def self.extended(base)
  base.class_eval do
    store_in collection: 'redactor_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