RailsでネストされたリレーションのN+1の解決方法
ranking.article.authorみたいなときの話。
N+1はincludesつけて回避するのがふつう。
http://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations
で、タイトルのケースも↑のリンクに書いてあるんだけど、こんな感じに書く。
続きを読むranking.article.authorみたいなときの話。
N+1はincludesつけて回避するのがふつう。
http://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations
で、タイトルのケースも↑のリンクに書いてあるんだけど、こんな感じに書く。
続きを読む