Sha256: 9eb8693d12d9d55823d881289112e4edc86ec46ab5d8fbe15ccc0f4da6c5d224
Contents?: true
Size: 1.42 KB
Versions: 5
Compression:
Stored size: 1.42 KB
Contents
require "mongoid_forums/engine" require 'mongoid_forums/sanitizer' require 'mongoid_forums/default_permissions' require 'sanitize' module MongoidForums mattr_accessor :per_page, :user_class, :formatter, :email_from_address, :sign_in_path class << self def per_page @@per_page || 20 end def decorate_user_class! MongoidForums.user_class.class_eval do include MongoidForums::DefaultPermissions has_many :mongoid_forums_posts, :class_name => "MongoidForums::Post", :foreign_key => "user_id" has_many :mongoid_forums_topics, :class_name => "MongoidForums::Topic", :foreign_key => "user_id" field :mongoid_admin, type: Boolean, default: false def mongoid_forums_admin? mongoid_admin end unless method_defined? :mongoid_forums_admin # Using +to_s+ by default for backwards compatibility def forum_display_name to_s end unless method_defined? :forum_display_name end end def user_class if @@user_class.is_a?(Class) raise "You can't set MongoidForums.user_class to be a class. Please use a string instead.\n\n " + "See https://github.com/radar/mongoid_forums/issues/88 for more information." elsif @@user_class.is_a?(String) begin Object.const_get(@@user_class) rescue NameError @@user_class.constantize end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems