I’m new to Ruby on Rails and I have what I thought was a simple problem,
but I can’t get it to work.
I have a form which should save multiple rows into the mySQL table and I
am trying to use a block to loop through the code to write out to the
database but I can’t get the params to pass in the block.
I used this in my partial:
<%= text_field( :ticketing_price, :price_category, :index => @tdcount
<%= text_field( :ticketing_price, :number_available, :index =>
@tdcount ) %>
where as the @tdcount increases by one each time the partial is rendered
in the main view, therefore the name of the input is
In my controller, I did this which apparently is wrong:
params['ticketing_price'].each do |t| ticketing_price = TicketingPrice.new ticketing_price = ticketing_price[t] ticketing_price.save end
Please tell me what I am doing wrong. My models are setup correctly (at
least for saving one row at a time, without using the block).