I'm experiencing some unexpected weirdness with acts_as_tree.
class Category < ActiveRecord::Base acts_as_tree has_many :variations end
def variations # some code that returns the parent category variations if we have none end
pc = Category.new pc.variations << "foo" pc.save cc = Category.new cc.parent = pc cc.save
So far so good ...
pc.variations .... ["foo"] cc.variations .... ["foo"]
pc.variations.clear
pc.variations ... <--- that's expected cc.variations ... ["foo"] <-- UNEXPECTED!! cc = Category.find 2 cc.variations ... <-- again, expected
What's going on here? The reference to pc and cc.parent are also not equal (before reloading even) but I guess that's just how AR works. I'm used to Hibernate returning the same reference.
Any suggestions or explanations?
TIA,
Sean