{"url":"https://itmsc.hatenadiary.org/entry/20100416/1271393055","blog_url":"https://itmsc.hatenadiary.org/","categories":["Ruby on Rails"],"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fitmsc.hatenadiary.org%2Fentry%2F20100416%2F1271393055\" title=\"build\u3063\u3066\u4f55\u3060\u308d\u3046\uff1f - \u3044\u3068\u3046\u307e\u3055\u3057\u306e\u30ab\u30c1\u30e3\u30ab\u30c1\u30e3TODAY\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","title":"build\u3063\u3066\u4f55\u3060\u308d\u3046\uff1f","image_url":null,"width":"100%","blog_title":"\u3044\u3068\u3046\u307e\u3055\u3057\u306e\u30ab\u30c1\u30e3\u30ab\u30c1\u30e3TODAY","author_url":"https://blog.hatena.ne.jp/itmsc/","description":"ActiveRecord\u306e\u30a2\u30bd\u30b7\u30a8\u30fc\u30b7\u30e7\u30f3\u3092\u6271\u3046\u30e1\u30bd\u30c3\u30c9\u3067\u300cbuild\u300d\u3068\u3044\u3046\u306e\u3092\u521d\u3081\u3066\u77e5\u308a\u307e\u3057\u305f\u3002 class Group ActiveRecord::Base has_many :users end class User ActiveRecord::Base belongs_to :group end \u3068\u3044\u3046\u30a2\u30bd\u30b7\u30a8\u30fc\u30b7\u30e7\u30f3\u304c\u3042\u3063\u305f\u3068\u304d\u306b\u3001 @group.users.build params \u307f\u305f\u3044\u306a\u611f\u3058\u3067\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 @group.users << user\u307f\u305f\u3044\u306a\u30b3\u30fc\u30c9\u306f save \u307e\u3067\u5b9f\u884c\u3055\u308c\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u5834\u5408\u306b\u3088\u3063\u3066\u306f build \u306e\u65b9\u304c\u3044\u3044\u304b\u3068\u3002belongs_to \u306b\u3064\u2026","provider_url":"https://hatena.blog","author_name":"itmsc","height":"190","provider_name":"Hatena Blog","type":"rich","version":"1.0","published":"2010-04-16 13:44:15"}