rails / protected_attributes

Protect attributes from mass-assignment in ActiveRecord models.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NoMethodError: undefined method `sanitize' for false:FalseClass

gisborne opened this issue · comments

/Users/guyren/.rvm/gems/ruby-2.1.0/gems/protected_attributes-1.0.8/lib/active_model/mass_assignment_security.rb:346:in `sanitize_for_mass_assignment’

which is where the gem asks itself for a sanitizer object and fails.

I’ve got:

config.active_record.whitelist_attributes = true

I believe the problem maybe arises in some fashion from the object I’m trying to save having a json field.

Rails 4.1.

Thank you for the report. How can we reproduce this error?

I tried creating a new empty project with a dummy spec and tracing the spec works fine. I'm not sure how to go about reproducing this.

The most obvious thing is that I'm writing an engine inside a larger project. I've got the engine open at its root inside RubyMine, and I'm trying to run a spec defined at that level.

Is there some way to get a log of what the debugger or the gem it's talking to think is going on? There are so many moving parts here, it's hard to know how to isolate the problem. I don't see any way to provide the project, or I would do so. I guess I could post it on dropbox or something...

This error is caused because your mass_assignment_sanitizer value is set to false. Make sure you configured the right value