Saturday, May 3, 2008

DangerousAttributeError

I came across this weird sounding exception while creating a record. At first I didn't know what was wrong with my table. After a little probing I figured it was being caused by an attribute called 'frozen' in my table. I was using it to indicate if that record is frozen or not. But it appears Rails uses this keyword internally for the same purpose I was using that attribute for. I had to change this attribute to a different name (I named it 'frosen') for it to work.

This is what Rails api says about the error:
Raised when attribute has a name reserved by ActiveRecord (when attribute has name of one of ActiveRecord instance methods).

http://api.rubyonrails.com/classes/ActiveRecord/DangerousAttributeError.html

1 comment:

Vladmir said...

Dude, you saved me. You are the man.