Sha256: 6fd6731d1eb1c01d1b9d38f876682e77dba0a4e557e4220ffc2efd0ddada3fab
Contents?: true
Size: 915 Bytes
Versions: 2
Compression:
Stored size: 915 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}, {visible_for_user_ids: []}) } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails_admin_comments-0.3.0.4 | lib/rails_admin_comments/models/mongoid/comments.rb |
rails_admin_comments-0.3.0.3 | lib/rails_admin_comments/models/mongoid/comments.rb |