Ruby on Rails v3.2.11 modelã¯ã©ã¹ã®ä¸ã§ã®selfã®ä½¿ãæ¹ã§ããrailsã®ã«ã¼ã«ã¨ããããã¯rubyã®ã«ã¼ã«ã§ãããmodelã®ä¸ã§selfã使ãã¨ãã«æã ä¸å®ã«ãªãã®ã§ã¡ã¢ã£ã¦ããã¾ãã ã¯ã©ã¹ã¡ã½ããã¨ã¤ã³ã¹ã¿ã³ã¹ã¡ã½ãã modelã¯ã©ã¹ã®ä¸ã§ã¡ã½ãããå®ç¾©ããéã«ãã¡ã½ããåã®é ã«self.ãã¤ããã¨ã¯ã©ã¹ã¡ã½ãããã¤ããªãã¨ã¤ã³ã¹ã¿ã³ã¹ã¡ã½ããã«ãªãã¾ãã class User < ActiveRecord::Base def hoge #ã¤ã³ã¹ã¿ã³ã¹ã¡ã½ãã end def self.hoge #ã¯ã©ã¹ã¡ã½ãã (def User.hoge ã¨ãã£ã¦ãåãæå³) end end ã¡ãªã¿ã«ä½¿ãåãã§ãããã¤ã³ã¹ã¿ã³ã¹ã¡ã½ããã¯ããããã®ã¤ã³ã¹ã¿ã³ã¹ã«å¯¾ãã¦åç §ã»æ´æ°ãããããªã¡ã½ããã¨ãã¦ä½¿ãã¾ããä¸æ¹ã¯ã©ã¹ã¡ã½ããã¯ãmodelã¯ã©ã¹ã®ã¬ã³ã¼ããæ¤ç´¢
{{#tags}}- {{label}}
{{/tags}}