I want to make a form in which the user can select a number between 1 and 30. I am trying to do something like this:
<%= f.select("@currency.neural_network", "prediction_days", [1..30]) %>
However, I am getting the below error.
Failure/Error: click_link 'Show'
ActionView::Template::Error:
undefined method `merge' for [1..30]:Array
The code for the entire form is:
<%= form_for @currency.neural_network do |f| %>
<%= f.label "Days" %><br />
<%= f.select("@currency.neural_network", "prediction_days", [1..30]) %>
<%= f.submit "Predict", class: "btn btn-primary" %>
<% end %>
Take a look at the documentation for select
. Assuming you want prediction_days
to be passed to your controller as a value between 1 and 30, and prediction_days
is an attribute of a neural_network
object, then the following should work for you:
<%= f.select(:prediction_days, options_for_select(1..30)) %>