I have a Rails application which runs just fine in both development and production mode on the development system, which is Mac OS X. Not Edge Rails, but the last release. However, when I deploy the app to the production system, FreeBSD 6.1, AMD-64, I get consistent errors on many of the controllers, but not all.
What happens is that ActionView seems to pass the wrong kind of object to the views. Thus I get
undefined method `event_levels' for #<#<Class:0x18298c0>:0x1829870>
Extracted source (around line #16):
14: <td><%= link_to event.name, :action => 'show', :id => event %></td>
15: <td><%= event.kind %></td>
16: <td><%= event_levels event %></td>
17: <td><%= event.max_places %></td>
18: <td><%= event.accepted_bookings.length %></td>
19: <td><%= link_to 'Edit', :action => 'edit', :id => event %></>
Where the "Class" object in this case should be an Event. The same thing goes for other types of objects, such as Payments. It is completely consistent when it appears, it happens in both production and development mode on the deployment system, but some of the controllers/views do not seem to be affected at all.
It seems that it affects views which do explicit rendering using shared templates, but it is not consistent. Some views break even if they do not use any shared templates. It also seems to affect most of the controllers located in a subfolder to app/controllers - /admin/ - but again, not consistently so. (I remember reading somewhere that there are problems with subfolders in the controller folder, but again, some of the controllers work as they should.)
It should be pointed out that this does *not* happen with another app deployed to the same FreeBSD machine. The malfunctioning app is the newer one. The behaviour is the same under Webrick, Mongrel and LiteSpeed.
I can see no recurring pattern at all. Any ideas before I start tracing the internals of Rails?
/ Peter Bengtson