{"action":"created","issue":{"url":"https://api.github.com/repos/jinzhu/gorm/issues/352","labels_url":"https://api.github.com/repos/jinzhu/gorm/issues/352/labels{/name}","comments_url":"https://api.github.com/repos/jinzhu/gorm/issues/352/comments","events_url":"https://api.github.com/repos/jinzhu/gorm/issues/352/events","html_url":"https://github.com/jinzhu/gorm/issues/352","id":55853123,"number":352,"title":"belongs_to 的关联查询在没有 includes 实现的情况下，你们是如何解决问题的？","user":{"login":"huacnlee","id":5518,"avatar_url":"https://avatars.githubusercontent.com/u/5518?v=3","gravatar_id":"","url":"https://api.github.com/users/huacnlee","html_url":"https://github.com/huacnlee","followers_url":"https://api.github.com/users/huacnlee/followers","following_url":"https://api.github.com/users/huacnlee/following{/other_user}","gists_url":"https://api.github.com/users/huacnlee/gists{/gist_id}","starred_url":"https://api.github.com/users/huacnlee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huacnlee/subscriptions","organizations_url":"https://api.github.com/users/huacnlee/orgs","repos_url":"https://api.github.com/users/huacnlee/repos","events_url":"https://api.github.com/users/huacnlee/events{/privacy}","received_events_url":"https://api.github.com/users/huacnlee/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-01-29T03:55:18Z","updated_at":"2015-01-30T05:17:16Z","closed_at":null,"body":"比如 ActiveRecord 里面这样\r\n\r\n```ruby\r\nclass User\r\nend\r\n\r\nclass Post\r\n  belongs_to :user\r\nend\r\n\r\n@posts = Post.includes(:user).limit(10)\r\n```\r\n\r\n```erb\r\n<% @posts.each do |p| %>\r\n  <li><span><%= p.user.try(:nick) %></span> <%= p.title %></li>\r\n<% end %>\r\n```\r\n\r\n在 Gorm 里面应该如何实现？"},"comment":{"url":"https://api.github.com/repos/jinzhu/gorm/issues/comments/72155468","html_url":"https://github.com/jinzhu/gorm/issues/352#issuecomment-72155468","issue_url":"https://api.github.com/repos/jinzhu/gorm/issues/352","id":72155468,"user":{"login":"jinzhu","id":6843,"avatar_url":"https://avatars.githubusercontent.com/u/6843?v=3","gravatar_id":"","url":"https://api.github.com/users/jinzhu","html_url":"https://github.com/jinzhu","followers_url":"https://api.github.com/users/jinzhu/followers","following_url":"https://api.github.com/users/jinzhu/following{/other_user}","gists_url":"https://api.github.com/users/jinzhu/gists{/gist_id}","starred_url":"https://api.github.com/users/jinzhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jinzhu/subscriptions","organizations_url":"https://api.github.com/users/jinzhu/orgs","repos_url":"https://api.github.com/users/jinzhu/repos","events_url":"https://api.github.com/users/jinzhu/events{/privacy}","received_events_url":"https://api.github.com/users/jinzhu/received_events","type":"User","site_admin":false},"created_at":"2015-01-30T05:17:16Z","updated_at":"2015-01-30T05:17:16Z","body":"> 为何不在 struct 上面定一个 User 呢\r\n\r\n这个是从测试里面拷贝出来的，struct里面定义struct的也有测试\r\n\r\n> 我现在实际上是这么做的\r\n\r\n嗯，现在是要这样子做的，等我加上include, 来解决N+1的问题"}}