The goal is to pre-populate the form with seed data: https://github.com/ornerymoose/GarageApp
The relevant code for iterating over stall numbers is in
@garage = Garage.new
for i in 1..5
@garage.cars.build :stall_number => i
This will give 5 stall_number string values of 1, 2, 3, 4, and 5. Instead of that, how would I iterate over the values in the
So instead of the stall_numbers having values of 1, 2, 3, 4, and 5. They would have the string values listed in the seeds.rb file.
Here is the
fields_for block in the garage
<%= f.fields_for :cars do |builder| %>
<p>Enter license for car parked in stall: <%= builder.object.stall_number %></p>
<%= builder.label :license, "License #:" %><br />
<%= builder.text_field :license %>
<% end %>
Any input on the matter is greatly appreciated.