I am trying to create a runner script to build a model. The model is this:
class Day < ActiveRecord::Base
has_many :slots
attr_accessible :available, :day_date, :venue
end
class Slot < ActiveRecord::Base
belongs_to :day
end
I would like to make 100 blank Days with 9 Slots for each Day. This is runner script load_days.rb
Day.transaction do
(1..100).each do |i|
days = Date.today+i
Day.create( :available => "Available", :venue => "Pitch_1", :day_date => days )
(1..9).each to |j|
hours = days.hours+j
id = Day.id
Slot.create ( :time_slot => hours , :day_id => id )
end
end
end
I am getting the following error: script/load_days.rb:8: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.' Slot.create ( :time_slot => hours , :day_id => id )