Ruby on rails read csv file and fill table

1

I have the following news table:

create_table "noticia", force: true do |t|
    t.integer  "conteudo_id"
    t.integer  "entidade_id"
    t.integer  "imagem_id"
    t.string   "texto"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

and I have the following a .csv file where it contains these fields in the following format:

ImageText, url image

I appreciate the help of how to read the file and also if necessary you can change the layout of the file.

    
asked by anonymous 24.06.2014 / 15:05

1 answer

1

To format csv for AR format, use this gem:

link

    
24.06.2014 / 18:42