Railsã§ãã¼ãã«ã®ãªã¬ã¼ã·ã§ã³ãã§ãããªãã¦ããã¯ãªã ã ãã¾ãã«ã¡ãã¼ç°¡åãã¾ããããã¬ãã·ã§ããã³ã°ã®å¤äººå¸ä¼è ãåºã¦ãã¦ããããªã«ç°¡åãªãã¦ä¿¡ãããããã¼ããã¸ã§ã³ã 1:1ã®å ´å ã©ã¡ããä¸æ¹ã®ãã¼ãã«ã«ããã¼ãã«åã®åæ°å½¢ã_idã¨ãããã£ã¼ã«ããä½æããã authors id post_id post id class Author < ActiveRecord:Base belongs_to(:post) end class Post < ActiveRecord:Base has_one(:author) end 1:nã®å ´å nå´ã®ãã¼ãã«ã«1å´ã®ããã¼ãã«åã®åæ°å½¢ã_idã¨ãããã£ã¼ã«ããä½æããã users id group_id group id class User < ActiveRecord::Base belongs_to(:group) end
{{#tags}}- {{label}}
{{/tags}}