Sha256: 4fab9d9c566489ff39200792751d6b9de8a8661245c8008e675da884740647bf

Contents?: true

Size: 1.01 KB

Versions: 35

Compression:

Stored size: 1.01 KB

Contents

require 'orm_adapter/adapters/mongoid'
require 'ckeditor/orm/base'

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

        module InstanceMethods
          def type
            _type
          end

          def as_json_methods
            [:id, :type] + super
          end
        end

        module ClassMethods
          def self.extended(base)
            base.class_eval do
              field :data_content_type, :type => String
              field :data_file_size, :type => Integer
              field :width, :type => Integer
              field :height, :type => Integer

              belongs_to :assetable, :polymorphic => true
            end
          end
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 4 rubygems

Version Path
danabr75-ckeditor-4.1.6 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.6.0 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.5.10.3 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.5.10.2 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.5.10.1 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.5.7.1 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.5.7 lib/ckeditor/orm/mongoid.rb
ckeditor_custom_controller-4.1.6 lib/ckeditor/orm/mongoid.rb
ckeditor-4.1.6 lib/ckeditor/orm/mongoid.rb
ckeditor-4.1.5 lib/ckeditor/orm/mongoid.rb
ckeditor-4.1.4 lib/ckeditor/orm/mongoid.rb
ckeditor-4.1.3 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.4.7.4 lib/ckeditor/orm/mongoid.rb
ckeditor-4.1.2 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.4.7.3 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.4.7.2 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.4.7.1 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.4.7 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.4.6 lib/ckeditor/orm/mongoid.rb
ckeditor-4.1.1 lib/ckeditor/orm/mongoid.rb