æ¨æ¥ãããªè¨äºã話é¡ã«ãªã£ã¦ãã¾ããã â« ç»é²ãããã¨ã¤ããã¦ã¼ã¶ã¼åãªã¹ã - Qiita ãããã¡ããã©ã¾ãã«ããããã«ã¼ãã£ã³ã°ã®Webãµã¼ãã¹ãä½ã£ã¦ããã¨ããã ã£ãããã®ã§ãã¨ã¦ãåèã«ãªãæ å ±ãã¨ãããã¨ã§ãµã¯ãã¨Railsã®Validatorã«ãã¦ã¿ã¾ãããå è¨äºã®ã³ã¡ã³ãã«æ¸ããã¦ãããã®ã¨ãèªåã§æãã¤ãããã®ã追å ãã¦ããã¾ããã¤ãã§ã«è¤æ°å½¢ã«ã対å¿ãã¦ã¾ãã ãããapp/validators/ban_reserved_validator.rbã«é ç½®ã Modelå´ã§ã¯ãããªæãã§å®ç¾©ããã°äºç´èªãç¦æ¢ã§ããã class User < ActiveRecord::Base validates :name, ban_reserved: true end ããåææãããã¾ãããã¦ã¼ã¶ã¼ç»é²æã«ããèµ°ããªãå¦çãªã®ã§ããããªæãã®ãã¼ãã³ã¼ãã£ã³ã°ã§ãååãã¨ã
{{#tags}}- {{label}}
{{/tags}}