Sha256: 1d8cb8b3bd45c1434e639a19369c222c933e4d132e8526a9f660317a56348c7f

Contents?: true

Size: 635 Bytes

Versions: 2

Compression:

Stored size: 635 Bytes

Contents

module RailsAdminComments
  module Mongoid
    extend ActiveSupport::Concern
    included do
      include ::Mongoid::Document
      include ::Mongoid::Timestamps::Short
      include ::Mongoid::Userstamp

      belongs_to :rails_admin_commentable, polymorphic: true

      store_in collection: "rails_admin_comments"

      field :enabled, type: ::Mongoid::VERSION.to_i < 4 ? Boolean : ::Mongoid::Boolean, default: true
      scope :enabled, -> { where(enabled: true) }

      scope :by_date, -> { order([:c_at, :asc]) }

      field :content
      validates_presence_of :content

      scope :for_user, ->(user) {}
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_admin_comments-0.1.1 lib/rails_admin_comments/mongoid.rb
rails_admin_comments-0.1.0 lib/rails_admin_comments/mongoid.rb