Single Table Inheritanceã§è¦ªåé¢ä¿ã«ããäºã¤ã®ã¯ã©ã¹Hoge, Fugaãããã¨ããã class Hoge < ActiveRecord::Base end class Fuga < Hoge end ãã®ã¨ãHogeã¯ã©ã¹ã®ãªãã¸ã§ã¯ãaããã£ãã¨ãã¦ãããFugaã¯ã©ã¹ã«å¤æãããã¨ããã ããããããããç¶æ³ããªãã¸ã§ã¯ãæåçã«ã©ããªã®ãã¨ããã®ã¯ç½®ãã¦ããã ãã®ã¨ãã a = Hoge.find(1) b = a.becomes(Fuga) b.save! ã¨ããã°ããã®ãã¨æã£ã¦è©¦ãã¦ã¿ããããã¼ãããªããããªãã¸ã§ã¯ãã¯Hogeã¯ã©ã¹ã®ã¾ã¾ã ã£ãã ãªãã¸ã§ã¯ããä¿åããã¨ãã®ã¯ã¨ãªã¼ãè¦ãã¨æ¬¡ã®ããã«ãªã£ã¦ããã UPDATE `hoges` SET `type` = 'Fuga', `updated_at` = '2013-04-08 14:0
{{#tags}}- {{label}}
{{/tags}}