在我的控制器中我有
MessageContent.new(language: "en", body: "Write your english text here", title: "", sender: "Admin")
并且在视图中,我想将body作为占位符添加到我的输入
= f.input :body
我一直在寻找答案,但没有任何线索。 THX
答案 0 :(得分:1)
这应该有效
# controller
@message_content = MessageContent.new(language: "en", body: "Write your english text here", title: "", sender: "Admin")
# view
= f.input :body, placeholder: @message_content.body