This does work:
result.each do |f|
rt=ResTypes.new #( :type=>f['type'] )
rt.type=f['type']
rt.save()
end
This doesn’t work:
result.each do |f|
ResTypes.create( :type => f['type'] )
end
nor does this:
result.each do |f|
rt=ResTypes.new( :type => f['type'] )
rt.save()
end
Why wouldn’t the second or third way?
thx
edit #1
this does work:
t=IO.read('db/seed-data/list-types.json')
lt_results=JSON.parse(t)
lt_results.each do |i|
l=ListType.create(i)
end
Might have to do with that attribute not being able to be mass assigned. Other than that it looks like it should work.