ignorable icon indicating copy to clipboard operation
ignorable copied to clipboard

Don't allow ignored attributes to be dynamically defined

Open jooshbzm opened this issue 8 years ago • 0 comments

I noticed while adding this gem to our repo that in some cases, Rails still allows you to access ignored columns with attribute getters and setters. To reproduce, retrieve a record from the database and try to access the ignored column. Notice that Rails still returns the actual value for this column instead of raising a NoMethodError.

After doing some digging, it looks like Rails will try to dynamically define attributes even if they've previously been ignored. This PR overrides the attribute_method? method to return false for any ignored columns. I added a spec to demonstrate this case.

jooshbzm avatar Jan 05 '17 16:01 jooshbzm