Unknown validator: 'ForbidChangingValidator'
<p>I spend few hours trying to find solution of my problem, but lost any hope to understood what i am done wrong.</p>

<p><code>Rails 4.2.6</code></p>

<p>my model:</p>

<p><code>app/models/component.rb</code></p>

<pre><code>class Component &lt; ActiveRecord::Base

  validates :name, presence: true,
                 uniqueness: true,
            forbid_changing: true #TODO [VS] Fix custom validator autoload

  validates :label, presence: true,
                  uniqueness: true
end
</code></pre>

<p>my validator:</p>

<pre><code>class ForbidChangingValidator &lt; ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    if record.send "#{attribute}_changed?".to_sym
      record.errors[attribute] &lt;&lt; options[:message] || t(:changing_forbidden)
    end
  end
end
</code></pre>

<p>when try reload the page i got error:
<code>Unknown validator: 'ForbidChangingValidator'</code></p>

<pre><code>ArgumentError - Unknown validator: 'ForbidChangingValidator':
  activemodel (4.2.6) lib/active_model/validations/validates.rb:120:in `rescue in block in validates'
  activemodel (4.2.6) lib/active_model/validations/validates.rb:117:in `block in validates'
  activemodel (4.2.6) lib/active_model/validations/validates.rb:113:in `validates'
  app/models/component.rb:6:in `&lt;class:Component&gt;'
  app/models/component.rb:1:in `&lt;top (required)&gt;'
  activesupport (4.2.6) lib/active_support/dependencies.rb:457:in `block in load_file'
  activesupport (4.2.6) lib/active_support/dependencies.rb:647:in `new_constants_in'
  activesupport (4.2.6) lib/active_support/dependencies.rb:456:in `load_file'
  activesupport (4.2.6) lib/active_support/dependencies.rb:354:in `require_or_load'
  activesupport (4.2.6) lib/active_support/dependencies.rb:494:in `load_missing_constant'
  activesupport (4.2.6) lib/active_support/dependencies.rb:184:in `const_missing'
  activesupport (4.2.6) lib/active_support/inflector/methods.rb:261:in `block in constantize'
  activesupport (4.2.6) lib/active_support/inflector/methods.rb:259:in `constantize'
  activesupport (4.2.6) lib/active_support/core_ext/string/inflections.rb:66:in `constantize'
  repositor (0.6.0) lib/repositor/active_record.rb:6:in `initialize'
</code></pre>

<p>but when i am trying to call this validator from console i got:
<code>!! #&lt;ArgumentError: A copy of Component has been removed from the module tree but is still active!&gt;</code></p>

<p>I found a lot of messages about thig issue, but can't to resolve mine.</p>

<p>Please, help somebody....</p>