Sha256: 095daac572c450ea077936db240864550e3b469b7743e0e19d834d10f6f9eec9
Contents?: true
Size: 887 Bytes
Versions: 2
Compression:
Stored size: 887 Bytes
Contents
module RailsAdminComments module Comments module Mongoid extend ActiveSupport::Concern included do include ::Mongoid::Document include ::Mongoid::Timestamps::Short include ::Mongoid::Userstamp belongs_to :rails_admin_commentable, polymorphic: true, optional: true store_in collection: "rails_admin_comments".freeze 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 has_and_belongs_to_many :visible_for_users, class_name: "User", inverse_of: nil scope :for_user, ->(user) { any_of({visible_for_user_ids: user}, {visible_for_user_ids: nil}) } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails_admin_comments-0.3.0.1 | lib/rails_admin_comments/models/mongoid/comments.rb |
rails_admin_comments-0.3.0 | lib/rails_admin_comments/models/mongoid/comments.rb |