I have a Rails 3.0.9 app that, once it is deployed, suffers from a bunch of ActiveModel::MissingAttributeErrors that crop up causing 500s. The errors occur fairly randomly,
I encountered this issue. Make sure your select:
includes all fields referenced in your view, including any relationship IDs and any attributes called within your methods.
The missing attribute can be difficult to identify whenever your views and relationships are complex. The easiest way to debug this is to remove the select
portion of your where
clause and see if the query/scope/method runs correctly. If so, then add all of the attributes to the select
and remove unneeded attributes one-at-a-time until you find the offending attribute.