class Unidom::Common::Neglection
Neglection
根据配置信息忽略指定的类或者命名空间。
Public Class Methods
namespace_neglected?(class_name)
click to toggle source
判断指定的类名是否被忽略。如: Unidom::Common::Neglection.namespace_neglected?
'Namespace::ClassName' 在应用的 config/initializers/unidom.rb 文件中配置如下代码,即可忽略 Namespace::ClassName 这个类。 Unidom::Common.configure
do |options| # The migrations inside the following namespaces will be ignored. The models inside the following namespaces won't be defined. options = %w{
Namespace::ClassName
}
# File lib/unidom/common/neglection.rb, line 15 def self.namespace_neglected?(class_name) neglected_namespaces = Unidom::Common.try(:options).try(:[], :neglected_namespaces) neglected_namespaces.present? ? neglected_namespaces.include?(class_name.to_s.deconstantize) : false end