私はこれを持っています:
class User < ActiveRecord::Base
has_many :serials
has_many :sites, :through => :series
end
class Serial < ActiveRecord::Base
belongs_to :user
belongs_to :site
has_many :episodes
end
class Site < ActiveRecord::Base
has_many :serials
has_many :users, :through => :serials
end
class Episode < ActiveRecord::Base
belongs_to :serial
end
User.serials.episodesに対していくつかの操作を実行したいのですが、これはあらゆる種類の巧妙なトリックを意味することを私は知っています。理論的には、すべてのエピソードデータをシリアル化(非正規化)してから、必要に応じてgroup_bySiteに入れることができます。
クエリする必要のあるエピソードがたくさんある場合、これは悪い考えですか?
ありがとう