I am accessing a database that I can't change and it has a column named valid defined. Anytime I try to access an attribute, I get this exception:
valid? is defined by ActiveRecord (ActiveRecord::DangerousAttributeError)
The exception makes sense, but since I'm not able to change the database, how can I get around this error?
I tried "overriding" the attribute, but I don't know how to remove the original column. I can successfully call this valid_column method, but any time I try to access another attribute defined in the database, I get the same exception. It still seems to be trying to map the valid column.
def valid_column=(valid)
write_attribute(:valid, valid)
end
def valid_column
read_attribute(:valid)
end
I'm not sure if it matters, but here are the details of my environment:
- Windows Ruby 1.8.6
- Informix database on a Linux server
- activerecord (2.3.4)
- activerecord-informix-adapter (1.0.0.9250)
- ruby-informix (0.7.1)
Thanks in advance!