to_json not working because reflections are wrong

Bodo Tasche
2010-09-27T07:07:59Z

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.

--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at