{"image_url":null,"blog_url":"https://ikm.hatenablog.jp/","url":"https://ikm.hatenablog.jp/entry/2012/11/08/200511","width":"100%","description":"Rails has_many with dynamic conditions\u3088\u308a\u3001ActiveRecord 3.1+\u3067\u306fproc\u3092\u4f7f\u3046\u5fc5\u8981\u304c\u3042\u308b\u307f\u305f\u3044\u30023.2.8\u3067\u78ba\u8a8d\u6e08\u307f\u3002 class User has_many :pictures has_one :profile_picture, class_name: \"Picture\", foreign_key: \"user_id\", conditions: proc { [\"id = ?\", self.profile_picture_id] } end","version":"1.0","author_url":"https://blog.hatena.ne.jp/a2ikm/","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fikm.hatenablog.jp%2Fentry%2F2012%2F11%2F08%2F200511\" title=\"has_one, has_many, belongs_to\u3067conditions\u3092\u52d5\u7684\u306b\u3059\u308b - There&#39;s an echo in my head\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","blog_title":"There's an echo in my head","type":"rich","height":"190","title":"has_one, has_many, belongs_to\u3067conditions\u3092\u52d5\u7684\u306b\u3059\u308b","provider_url":"https://hatena.blog","provider_name":"Hatena Blog","author_name":"a2ikm","published":"2012-11-08 20:05:11","categories":["activerecord","tips","ruby","rails"]}