Как настроить мой начальный файл для создания моих данных со связанными записями?
Пока у меня есть:
# Arrays
strand = ['Oracy across the curriculum', 'Reading across the curriculum', 'Writing across the curriculum', 'Developing numerical reasoning', 'Using number skills', 'using measuring skills', 'Using data skills']
component_array = Component.all.map(&:id)
# Add each item in array
strand.each { |sample| Strand.create(name: sample) }
Отношения:
component has_many :strands
strand belongs_to :component
В рамках этого я хочу назначить component_array[0]
первым 3 элементам в моем массиве и component_array[1]
оставшимся 4 элементам.
Какой синтаксис мне следует использовать, буду ли я смотреть здесь на хэш?
Component
иStrand
? ЭтоStrand belongs_to :component
иComponent has_many :strands
? - person davegson   schedule 28.11.2014