-1
我想在我的数据库中推送虚拟内容。我的模型中存在1:n的关系。Rails:Seeds,Relationship
seeds.rb
:
city= City.create([{:ort_name=>"Hagen"}])
person= Person.create([{:name = "root"}])
我试试这个
city << person
和
person.city_id = city.id
你会如何做呢?
尝试这些了,也许有人知道吗? – ubuseral 2013-02-18 18:37:58