Railsã§ã¯ãActiveRecordã®has_manyã¨belogns_toã使ããã¨ã§ãDBã®ã1対å¤ãã®ãã¼ãã«éã®ãªã¬ã¼ã·ã§ã³ãã¢ãã«ã«ç°¡åã«å®è£ ãããã¨ãã§ãã¾ãã åä½ç¢ºèª Rails 4.1 ActiveRecord 4.1 ç®æ¬¡ 1対å¤é¢é£ã¨ã¯ åç §å ã®å¤é¨ãã¼ã追å ãã ã¢ãã«ã«has_manyã¨belongs_toã追å ãã 使ããããã«ãªãã¡ã½ãã 1. 1対å¤é¢é£ã¨ã¯èª¬æã®ããã«æ¬¡ã®ERå³ãå®è£ ãã¦ã¿ã¾ãã 顧客1人ãè¤æ°å注æãããã®ã§ãã顧客ãããè¦ãã¨ã注æãã¯"å¤"ã§ãã ã¾ããï¼æ³¨æã¯å¿ ãä¸äººã®é¡§å®¢ãã注æãããªãã®ã§ãã注æãããè¦ãã¨ã顧客ãã¯"1"ã§ãã ãã®ãããªé¢ä¿ãã1対å¤é¢ä¿ãã¨ããã¾ãã 2. åç §å ã®å¤é¨ãã¼ã追å ããã¾ããå¤å´ã®ãã¼ãã«ï¼ä»åã¯ordersãã¼ãã«ï¼ã«xxx_idã¨ããåã§å¤é¨ãã¼ã追å ãã¾ãã xxxã®ç®æã¯åç §å ã®
{{#tags}}- {{label}}
{{/tags}}