3

I have an application in which I use a database that already existed and already has several data that I can not change.

I want to access this data using ActiveRecord, but the problem is that several of these models have a column called hash and ActiveRecord raises the exception:

ActiveRecord::DangerousAttributeError: hash is defined by ActiveRecord

What can I do to not override the hash method and the same time manage to access this column?

2

1 Answer 1

2

Have a look at the safe_attributes gem. Looks like it is built for your problem.

Sign up to request clarification or add additional context in comments.

1 Comment

i really don't want to use a gem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.