Sha256: 5e26a7b6ed848f3e6108e7113b7a3aee17d644f8978fb4d3be60ed871f91dee3

Contents?: true

Size: 932 Bytes

Versions: 3

Compression:

Stored size: 932 Bytes

Contents

require 'redactor2_rails/orm/base'

module Redactor2Rails
  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 => '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
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redactor2_rails-0.1.3 lib/redactor2_rails/orm/mongoid.rb
redactor2_rails-0.1.2 lib/redactor2_rails/orm/mongoid.rb
redactor2_rails-0.1.1 lib/redactor2_rails/orm/mongoid.rb