From: laredotornado Date: 2008-01-24T15:04:57+09:00 Subject: What is the right way to access this param value? Hi, I have several fields on my page, distinguished by numbers in the id: <% for i in 1 .. 5 %>
<%= text_field_tag("prescription_number" + i.to_s, "") %> <%= text_field_tag("description" + i.to_s, "") %>
Prescription Number Description
<% end %> However, when I try and access the values in my controller, i = 0 while params[:prescription_number + i.to_s] != nil and params[:description + i.to_s] != nil # line 7 session[:prescription_number + i.to_s] = params[:prescription_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 :prescription_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