如果特定对象为空、nil 或空白,我有一个text_area
我想设置的属性。placeholder
我目前正在这样做:
<%= f.text_area :comment, placeholder: @response.followup ||= "Would you like to add a note?" %>
如果@response.followup
is ,这似乎有效nil
,但如果它只是空的......它不使用"Would you like to add a note?"
我设置的默认文本。