Ibrahim Muhammad
Ibrahim Muhammad

Reputation: 2896

uninitialized constant ActiveRecord::Base::StrictgitSanitizer

I am trying to run rake for testing my Rails 3.2.3 app and I'm getting this weird error

gems/1.9.1/gems/activemodel-3.2.3/lib/active_model/mass_assignment_security.rb:206:in `const_get': uninitialized constant ActiveRecord::Base::StrictgitSanitizer (NameError)

My specs files are completely empty, I havn't started writing test code yet, just blank auto generated spec files.

I need ideas on how to debug this problem.

Upvotes: 0

Views: 452

Answers (1)

echristopherson
echristopherson

Reputation: 7074

I wonder if you accidentally pasted the word git into config.active_record.mass_assignment_sanitizer = :strict inside your config/environment.rb. Somehow, ActiveModel is using Strictgit as part of a name, where it should be using something like Logger or Strict.

I just looked at line 206 of gems/1.9.1/gems/activemodel-3.2.3/lib/active_model/mass_assignment_security.rb, where the error occurs. The method surrounding line 206 is:

def mass_assignment_sanitizer=(value)
  self._mass_assignment_sanitizer = if value.is_a?(Symbol)
    const_get(:"#{value.to_s.camelize}Sanitizer").new(self)
  else
    value
  end
end

As far as I see, mass_assignment_sanitizer=(value) only gets called with the values of :logger and :strict in Rails itself.

Upvotes: 2

Related Questions