Sha256: cd5ca0a89189c0e710a27d522103702d3f2fdefbcfd6b69c402911bd82e15109
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
require "mongoid_forums/engine" require 'mongoid_forums/sanitizer' require 'mongoid_forums/default_permissions' require 'sanitize' require 'decorators' module MongoidForums mattr_accessor :per_page, :user_class, :formatter, :email_from_address, :sign_in_path class << self 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 per_page @@per_page || 20 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongoid-forums-1.0.3 | lib/mongoid_forums.rb |