Ruby on rails 如何从文本字段获取输入并将其用作RubyonRails中的变量

Ruby on rails 如何从文本字段获取输入并将其用作RubyonRails中的变量,ruby-on-rails,ruby,ruby-on-rails-3,ruby-on-rails-4,apple-push-notifications,Ruby On Rails,Ruby,Ruby On Rails 3,Ruby On Rails 4,Apple Push Notifications,我有一个文本字段标签 <%= form_tag do %> <%= label_tag(:my_name, "Enter the name:") %> <%= text_field_tag(:my_name) %> <%= submit_tag("Process") %> <% %> <% end %> 我想要的是这个 使用来自文本字段的输入设置“hello world”部分 我该怎么做 我搜索了一个答案

我有一个文本字段标签

<%= form_tag do %>
  <%= label_tag(:my_name, "Enter the name:") %>
  <%= text_field_tag(:my_name) %>
  <%= submit_tag("Process") %>
  <%  %>
<% end %>
我想要的是这个

使用来自文本字段的输入设置“hello world”部分

我该怎么做


我搜索了一个答案,但未能找到答案。

您想从参数中获取答案,如下所示:

def send_notification
  logger.info "Device token registrato: " + params[:token].to_s
  APNS.send_notification(params[:token].to_s, params[:my_name] )
  redirect_to home_index_path, :notice => "Notification sent to device #{params[:token]}"
end

应该发送什么通知?单击“发送通知”链接或提交表单?单击“发送通知”或提交表单,两者都将发送通知通知。通知需要有哈希或字符串。这是我收到的错误,因为当我按下“发送通知”按钮时它为空。参数[:my_name]为空。我如何存储它
def send_notification
    logger.info "Device token registrato: " + params[:token].to_s
    APNS.send_notification(params[:token].to_s, 'hello world' )
    redirect_to home_index_path, :notice => "Notification sent to device #{params[:token]}"
  end
def send_notification
  logger.info "Device token registrato: " + params[:token].to_s
  APNS.send_notification(params[:token].to_s, params[:my_name] )
  redirect_to home_index_path, :notice => "Notification sent to device #{params[:token]}"
end