I am working on populating my database with test data using populate.rake:
Repertoire.includes(:jokes).each do |r|
@jokes = r.jokes
Skit.populate 8..12 do |skit|
skit.joke_id = @jokes[rand(@jokes.count)].id
end
end
This is giving me a RuntimeError: Called id for nil.
How can I populate a skit with random jokes?