has_many ストアの Account クラスがあります。Store クラスには、そのアカウントの他のすべてのストアを返すルーチンがあります。
def other_stores
if account then
account.stores.find(:all,:conditions=>"id != "+id.to_s)
else
[]
end
end
as_json ルーチンに :other_stores を含めて参照すると、CPU が固定されてハングします。other_stores での無限再帰であると想定しています。何か案は?再帰を止める方法はありますか?
ルビー 1.9.2-p136、レール 3.0.3