Sha256: 406056e08917b7e0a7163418abd66b4525b3648742b02a00801caba869691cda
Contents?: true
Size: 899 Bytes
Versions: 2
Compression:
Stored size: 899 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 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.2.3.3 | lib/rails_admin_comments/models/mongoid/comments.rb |
rails_admin_comments-0.2.3.2 | lib/rails_admin_comments/models/mongoid/comments.rb |