【发布时间】:2019-05-11 20:20:49
【问题描述】:
在 PHP 中,要在 PHP 中检索链接的值,我所要做的就是使用 $_GET['value']
现在在 Ruby on Rails 中,我该怎么做?例如,假设我有这个链接,我想检索它的 id 并在表单中使用它。
这是链接
<%= link_to "Message", new_message_path %># This link will allow the viewer to message the profile owner
这是消息脚本
<%= form_for(@message) do |f| %>
<%= render 'shared/error_messages', object: @message %>
<%= f.label :content %>
<%= f.hidden_field :receiver, value:# The ID should be retrieved from the user id of the previous page %>
<%= f.text_area :content, size:"20x15" %>
<%= f.submit "Send message", class: "btn btn-primary" %>
<% end %>
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-5