Hej,
Czy możliwe jest utworzenie 2 modeli w jednym czasie (w jednym form’ie), jeśli tabela A ma zawierać klucz z tabeli B? Nie chodzi mi tutaj o zwykłe has_many : belongs_to robione na modelach, ale o ustawienie już na samej bazie belongs_to. Dla uproszczenia dodam przykład:
Model_A
has_many: model_b, dependent: :destroy
end
Model_B
belongs_to: model_a
end
Migrations:
create_model_b #create table
t.belongs_to: model_a, index: true, foreign_key: true