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

and a class “Bar” that looks like this:

class Bar < Foo
belongs_to thirdmodel

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs