{"type":"rich","author_name":"ayaketan","title":"Rails4 3\u968e\u5c64\u306eincludes\u306e\u8907\u6570\u6307\u5b9a","provider_url":"https://hatena.blog","width":"100%","height":"190","provider_name":"Hatena Blog","description":"N+1\u554f\u984c\u89e3\u6c7a\u306e\u305f\u3081\u3001includes\u306e\u8a2d\u5b9a\u3092\u3057\u3066\u3044\u305f\u3002group\u304cuser\u3092\u53c2\u7167\u3057\u3066\u304a\u308a\u3001user\u304cdepartment\u3068post\u3092\u53c2\u7167\u3057\u3066\u3044\u308b\u3068\u304d\u3001group\u304b\u3089department\u3068post\u306e\u4e21\u65b9\u3092\u3092includes\u3067\u6307\u5b9a\u3059\u308b\u306e\u306b\u3061\u3087\u3063\u3068\u624b\u9593\u53d6\u3063\u305f\u3002group \u2192 user \u2192 department\u30fbpost \u4e0b\u8a18\u306e\u3088\u3046\u306b\u66f8\u3044\u305f\u3089\u3046\u307e\u304f\u3044\u3063\u305f @groups = Group.order(:id). includes({user: [:department, :post]}) \u95a2\u9023\uff1a Rails4 3\u968e\u5c64\u306eincludes\u306e\u6307\u5b9a - ayaketan\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u52c9\u5f37\u65e5\u8a18","version":"1.0","url":"https://ayaketan.hatenablog.com/entry/2014/07/14/113000","blog_url":"https://ayaketan.hatenablog.com/","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fayaketan.hatenablog.com%2Fentry%2F2014%2F07%2F14%2F113000\" title=\"Rails4 3\u968e\u5c64\u306eincludes\u306e\u8907\u6570\u6307\u5b9a - ayaketan\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u52c9\u5f37\u65e5\u8a18\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","published":"2014-07-14 11:30:00","author_url":"https://blog.hatena.ne.jp/ayaketan/","image_url":null,"categories":["Ruby"],"blog_title":"ayaketan\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u52c9\u5f37\u65e5\u8a18"}