I have a Rails model for a Recipe. It has an attribute, views, which counts how many times it has been viewed.
In the show action of my controller, I fetch the model object normally:
@recipe = Recipe.find(params[:id])
Then I increase the view count and save:
@recipe.views = @recipe.views + 1
@recipe.save
This works without a hitch locally, but on Heroku, the save apparently doesn't happen. No errors are thrown.
I can run this exact same code in the rails console on Heroku, and then it works.
The only way I can get it to work, is setting
config.cache_classes = false
in environmenst/production.rb
This is obvously not what I want, but I'm stumped about how to go from here.
I'm running Rails 3.2.8, Ruby 1.9.3 on the Cedar stack, using Postgresql 9.1 in both development and on production.