module Mongoid::Warnings
Encapsulates behavior around logging and caching warnings so they are only logged once.
@api private
Public Class Methods
warning(id, message)
click to toggle source
Define a warning message method for the given id.
@param [ Symbol ] id The warning identifier. @param [ String ] message The warning message.
@api private
# File lib/mongoid/warnings.rb, line 20 def warning(id, message) singleton_class.class_eval do define_method("warn_#{id}") do unless instance_variable_get("@#{id}") Mongoid.logger.warn(message) instance_variable_set("@#{id}", true) end end end end