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.
The error is :
NoMethodError: undefined method `macro' for nil:NilClass
from ~/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.0/lib/active_record/serialization.rb:41:in `block in serializable_add_includes'