ä»å¹´1æã«è»¢è·ãã¦æ°ããç°å¢ã§åãå§ãã¦ãã¦ãããã®ããã¸ã§ã¯ãã§ã¯Ruby on Railsã使ã£ã¦ãã¾ãã ä»ã¾ã§Ruby on Railsã§ãµã¼ãã¹çãä½ã£ãçµé¨ããã¾ãããªãRailsãç¥ãå¿ è¦ãåºã¦ãã¦ãæè¿åºçããããRuby on Rails5ã®ä¸æãªä½¿ãæ¹ãã¨ããæ¬ãè²·ãã¾ããã ãã®æ¬ã«ã¯ã¢ãã«ã®belongs_to ã«ä»¥ä¸ã®ãããªãªãã·ã§ã³ãæ¸ããã¦ãã¾ããã class Customer < ApplicationRecord has_many :orders end class Address < ApplicationRecord belongs_to :customer, optional: true end ãã® optional: true ã£ã¦ãªããªã®ãã çµè«ããè¨ãã¨ãbelongs_toã®å¤é¨ãã¼ã®nilã許å¯ããã¨ãããã®ã§ãã ä¸è¨ã®ã³ã¼ãã§ãã
{{#tags}}- {{label}}
{{/tags}}