Rails 3 ActiveRecord::Relation random associations behavior
问题 I am currently having a strange issue with an application migrated from rails 2.3.8 to rails 3 (3.0.1, 3.0.2, 3.0.3). At random moments associations behave strangely. In some cases, an associated object will return the Relation object, instead of the corresponding model. This seems to happen mostly on polymorphic associations. For example: class A belongs_to :b, :polymorphic => true end class B has_many :a, :as => :source end When invoking "a.b" this will "sometimes" return the Relation