Sha256: d6f806884985ad9bf15ce35f97d58a4522cb0458ebfb8244f23ff3ca1712247a

Contents?: true

Size: 931 Bytes

Versions: 5

Compression:

Stored size: 931 Bytes

Contents

require 'redactor3_rails/orm/base'

module Redactor3Rails
  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

5 entries across 5 versions & 1 rubygems

Version Path
redactor3_rails-0.1.5 lib/redactor3_rails/orm/mongoid.rb
redactor3_rails-0.1.4 lib/redactor3_rails/orm/mongoid.rb
redactor3_rails-0.1.3 lib/redactor3_rails/orm/mongoid.rb
redactor3_rails-0.1.2 lib/redactor3_rails/orm/mongoid.rb
redactor3_rails-0.1.1 lib/redactor3_rails/orm/mongoid.rb