To_json not working because reflections are wrong

I have a class called “Foo” that looks like this:

class Foo < ActiveRecord::Base
belongs_to othermodel
end

and a class “Bar” that looks like this:

class Bar < Foo
belongs_to thirdmodel
end

When i try to serialize bar with : bar.first.to_json(:include
=> :othermodel), it fails in production mode. Strangely it works in
the development environment. I digged around and found that the
bar.first.class.reflections.keys only includes “thirdmodel” and not
“othermodel” in production mode.

I can’t explain that, in rails 2 and in the development environment it
works prefect.