Sha256: 9e7ba13fdb8bb55dcccac4402a3b166009fa3c7d0eb3730b92d86b0ac8fba11f

Contents?: true

Size: 1.14 KB

Versions: 22

Compression:

Stored size: 1.14 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
              
              attr_accessible :data, :assetable_type, :assetable_id, :assetable
            end
          end
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 3 rubygems

Version Path
glebtv-ckeditor-4.0.2.7 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.0.2.6 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.0.2.5 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.0.2.4 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.0.2.2 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.0.2.1 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.0.2 lib/ckeditor/orm/mongoid.rb
glebtv-ckeditor-4.0.1 lib/ckeditor/orm/mongoid.rb
ckeditor-4.0.0 lib/ckeditor/orm/mongoid.rb
ckeditor-4.0.0.rc2 lib/ckeditor/orm/mongoid.rb
lafeber_ckeditor-3.7.3 lib/ckeditor/orm/mongoid.rb
ckeditor-4.0.0.rc1 lib/ckeditor/orm/mongoid.rb
ckeditor-3.7.3 lib/ckeditor/orm/mongoid.rb
ckeditor-3.7.2 lib/ckeditor/orm/mongoid.rb
ckeditor-3.7.1 lib/ckeditor/orm/mongoid.rb
ckeditor-3.7.0 lib/ckeditor/orm/mongoid.rb
ckeditor-3.7.0.rc3 lib/ckeditor/orm/mongoid.rb
ckeditor-3.7.0.rc2 lib/ckeditor/orm/mongoid.rb
ckeditor-3.7.0.rc1 lib/ckeditor/orm/mongoid.rb
ckeditor-3.6.3 lib/ckeditor/orm/mongoid.rb