ã¦ã¼ã¶ã¢ãã« class User < ActiveRecord::Base # ååã«é¢ãã validate # :presence -> æªå ¥åã¯ã¨ã©ã¼ # :unique -> å ¥åãããååããã§ã« DB ã«åå¨ããã°ã¨ã©ã¼ # (ã¢ãã«ã ãã® validate ã§ã¯å®å ¨ã«ä¸ææ§ãä¿è¨¼ã§ããªãã®ã§ï¼) # (å¿ ããã¼ãã«å®ç¾©å´ã§ãä¸ææ§ã«é¢ããæå®ãè¡ã£ã¦ãããã¨ï¼) # :length -> é·ãã¯æ大 32 æåã¾ã§ validates :name, :presence => true, :uniqueness => true, :length => { :maximum => 32 } # ã¡ã¼ã«ã«é¢ãã validate # :unique -> å ¥åãããã¡ã¼ã«ããã§ã« DB ã«åå¨ããã°ã¨ã©ã¼ # (ã¢ãã«ã ãã® validate ã§ã¯å®å ¨ã«ä¸ææ§ãä¿è¨¼ã§ããªãã®ã§ï¼
{{#tags}}- {{label}}
{{/tags}}