æ¦è¦ åèè ã®è¨±è«¾ãå¾ã¦ç¿»è¨³ã»å ¬éãããã¾ãã è±èªè¨äº: Drop this before validation and just use a setter method | Arkency Blog åæå ¬éæ¥: 2016/01/29 èè : Robert Pankowecki ãµã¤ã: Arkency Blog 2018/07/09: åçå ¬é 2022/03/09: æ´æ° 以ä¸ã®ãããªã³ã¼ãã¯å¤ãã®ããã¸ã§ã¯ãã§ç®ã«ãã¾ãã class Something before_validation :strip_title def strip_title self.title = title.strip end end ãããããã®è¦ä»¶ãæºããæ¸ãæ¹ã¯ä»ã«ãããã®ã§ãã class Something def title=(val) @title = val.strip end end
{{#tags}}- {{label}}
{{/tags}}