Ultimation
Ultimation

Reputation: 1069

Arrays frozen in Rails 3.2.4

I recently updated a rails app from 3.0.4 to 3.2.4 and I have a strange problem. It seems every array in my app has become frozen. For example if an array gets a set of articles from the database, that array will be instantiated at the first call of the method and will not change. If an article in the array is deleted in the database, it will still refer to it in the array. It only changes if I restart the server. However, when I call array.frozen? it returns false. And when I deploy to heroku I get this error:

!! Unexpected error while processing request: can't modify frozen array

Any suggestions on what might be causing this? I updated another app and didn't run into this problem.

Upvotes: 2

Views: 1042

Answers (1)

Ultimation
Ultimation

Reputation: 1069

Allright I got it working. I ran heroku run script/rails console and it gave me a new error that I hadn't seen yet. Turns out there was a random line of code in my environments/production.rb file that must've been copy and pasted accidentally or something. After removing it, it cleared up the frozen array problem. After some unrelated gem issues, I was able to get my site back online. So my advice is check your production.rb file and run the heroku console.

Upvotes: 4

Related Questions