L
laredotornado
Hi,
I have several fields on my page, distinguished by numbers in the id:
<% for i in 1 .. 5 %>
<tr><td>
<table>
<tr>
<td><%=
text_field_tag("prescription_number" + i.to_s, "") %></td>
<td><%= text_field_tag("description" +
i.to_s, "") %></td>
</tr>
<tr>
<td align="center">Prescription
Number</td>
<td align="center">Description</td>
</tr>
</table>
</td></tr>
<% end %>
However, when I try and access the values in my controller,
i = 0
while params[rescription_number + i.to_s] != nil and
params[:description + i.to_s] != nil # line 7
session[rescription_number + i.to_s] =
params[rescription_number + i.to_s]
session[:description + i.to_s] =
params[:description + i.to_s]
i += 1
end
I get the error
NoMethodError in OrderController#confirm
undefined method `+' for rescription_number:Symbol
RAILS_ROOT: ./script/../config/..
Application Trace | Framework Trace | Full Trace
/usr/local/apache2/htdocs/easyrx/app/controllers/order_controller.rb:
7:in `confirm'
What is the correct way to access my parameter values?
Thanks, - Dave
I have several fields on my page, distinguished by numbers in the id:
<% for i in 1 .. 5 %>
<tr><td>
<table>
<tr>
<td><%=
text_field_tag("prescription_number" + i.to_s, "") %></td>
<td><%= text_field_tag("description" +
i.to_s, "") %></td>
</tr>
<tr>
<td align="center">Prescription
Number</td>
<td align="center">Description</td>
</tr>
</table>
</td></tr>
<% end %>
However, when I try and access the values in my controller,
i = 0
while params[rescription_number + i.to_s] != nil and
params[:description + i.to_s] != nil # line 7
session[rescription_number + i.to_s] =
params[rescription_number + i.to_s]
session[:description + i.to_s] =
params[:description + i.to_s]
i += 1
end
I get the error
NoMethodError in OrderController#confirm
undefined method `+' for rescription_number:Symbol
RAILS_ROOT: ./script/../config/..
Application Trace | Framework Trace | Full Trace
/usr/local/apache2/htdocs/easyrx/app/controllers/order_controller.rb:
7:in `confirm'
What is the correct way to access my parameter values?
Thanks, - Dave