Bernardo Mendes
Bernardo Mendes

Reputation: 1220

Rails caching forms

i developed a project using Ruby on Rails and i having a huge problem after putting it on production environment.

All forms seems to being cached.

If i fill a whole form and send it to the server, the next time i access that form to create a new object, all fields will be already filled with previous data. This only happens on production environment, and i found that when i set this line to false, everything works fine:

config.cache_classes = true

Seems that this cache_Classes is causing the problem but i think that maybe another thing is causing the problem because cache_classes would only cache classes and not forms and i think that i may have a great performance loss with this config setted to false.

Please help!

Upvotes: 3

Views: 586

Answers (2)

Bernardo Mendes
Bernardo Mendes

Reputation: 1220

I found out what was the problem. In some models i was using cattr_accessor and i find that everything in forms that was being cached was the same fields i used cattr_accessor. Classes would be cached so seems that cattr_accessor would be cached too. I just replaced it with attr_accessor and everything works fine.

Thanks guys!

Upvotes: 1

Jeremy Weathers
Jeremy Weathers

Reputation: 2554

Try turning off your browser's auto form completion feature.

Upvotes: 0

Related Questions