我刚刚在我的 Rails 应用程序中加入了一个消息系统。当用户回复现有消息时,我希望主题字段填充“Re:#{subject}”或类似的内容。目前,发送的每条消息都只是一个带有主题和正文空白字段的表单。
以下是代码当前的样子:
<% @received.each do |a| %>
Sent from <%= link_to User.find(a.sender_id).name, User.find(a.sender_id) %>
<%= a.body %>
<%= link_to "Reply", new_user_message_path(user_id: current_user, instructor_id: User.find(a.sender_id)) %>
所以在这种情况下,上面的“回复”链接应该将主题作为参数传递给位于单独页面上的新消息表单。(如果主题是“绘画”,则回复链接应填写主题:“回复:绘画”)我该如何实现?