Ruby on Railsフォームから渡されたパラメータを使用するRubyスクリプトを実行しようとしています。ruby on railsは、フォームからルビスクリプトにパラメータを渡します。
これは私からの抜粋です:
<%= form_for(@test, :html => {:name => "test", :id => "test"}) do |f| %>
<div class="field", id="configure_device">
<%= f.label "Label1" %>
<%= f.text_field :Form_Param1 %>
<%= f.label "Label2" %>
<%= f.text_field :Form_Param2 %>
<%= f.label "Label3" %>
<%= f.text_field :Form_Param3 %>
< ...もっとtext_fields次のようにここでは...>
</div>
<div class="actions">
<%= button_to 'Apply Configs', :remote=>"true" %>
</div>
<% end %>
私のRubyスクリプトの構造は次のとおりです。
def apply_configs (param1, param2, param3, ..., etc.)
<... ruby code that executes based on the values passed in param1, param2, param3 ...>
end
私はこのRubyスクリプトを個別にテストしましたが、適切な入力パラメータを受け取ればうまく動作します"Apply Configs"ボタンがクリックされ、どのようにパラメータForm_Param1、Form_Param2、Form_Param3、...を渡すことができるかは、このRubyスクリプトをどのように実行することができますか? ..などをparam1、param2、param3、...などにマップする必要がありますか?あなたはparams
からそれを受信する必要
の必要はありませんいくつかの答えを受け入れます。 – Reactormonk