Sha256: 1d87ca34fcd84924d80816a169453b46e9e3f98be36feb99b96182ee25b7e4b8

Contents?: true

Size: 900 Bytes

Versions: 3

Compression:

Stored size: 900 Bytes

Contents

require 'redactor-rails/orm/base'

module RedactorRails
  module Orm
    module Mongoid
      module AssetBase
        def self.included(base)
          base.send(:include, Base::AssetBase::InstanceMethods)
          base.send(:extend, ClassMethods)
        end

        module ClassMethods
          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
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redactor-rails-paperclip-0.4.3 lib/redactor-rails/orm/mongoid.rb
redactor-rails-paperclip-0.4.2.1 lib/redactor-rails/orm/mongoid.rb
redactor-rails-paperclip-0.4.1 lib/redactor-rails/orm/mongoid.rb