私は(ポリモーフィック)オブジェクト(およびオブジェクトComment
に使用されます)を持っています。のs:のすべてを取得するにはどうすればよいですか? メソッドは に対して未定義であると書かれています。それを機能させる簡単な方法はありますか?多対多の関係ですか。多くの車両には多くのコメントがありますか? それとも私が間違っていますか?正常に動作します。 Vehicle
Review
comments
User
Vehicle
@user.vehicles.comments
comments
ActiveRecord::Relation
@user.vehicles.first.comments
オブジェクト間の関係 (完全ではありません):
User
has_many Vehicles.
Vehicle
belongs_to User.
has_many Comments (as commentable).
Comment
belongs_to Commentable, :polymorphic => true