2011å¹´07æ26æ¥13:29 Ruby Railsã¨ã³ã¸ãã¢ãªãããã ãã¯ç¥ã£ã¦ããã£ã¦ãã便å©ã¡ã½ãã Object#presence 㨠Object#try ã¨ãã便å©ãªã¡ã½ããããããã¨ããåç¥ã§ããï¼ãã®ï¼ã¤ã®ã¡ã½ããã¯ã¨ã£ã¦ã便å©ãªã®ã§ã¡ãã£ã¨ç´¹ä»ãã¦ã¿ã¾ãã Object#presence ã¡ã½ãã ããã¯ä»¥ä¸ã®ãããªå®ç¾©ã¨ãªã£ã¦ãã¾ãã def presence self if present? end present? ã¡ã½ããã¨ããã®ã¯ã¿ããªå¤§å¥½ã blank? ã®å対ã®ã¡ã½ãã (!blank?) ã§ãã ã¤ã¾ããnil, false, [](空é
å), {}(空ããã·ã¥), ""(空æåå), " "(åè§ã¹ãã¼ã¹ã ãã®æåå)ã§ããã° falseããã以å¤ã§ããã° true ã«ãªãã¾ãï¼blank? ã£ã¦åè§ã¹ãã¼ã¹ã ãã®æååã true ã¨å¤å®ããã®ç¥ã£ã¦
{{#tags}}- {{label}}
{{/tags}}