What's the best approach to import multiple lines from a text_area in a form?
I've tried a quick bodge using FasterCSV but get a NoMethodError:
undefined method `pos' for {"name"=>"Carrots\r\nPeas\r\nRed Onion"}*
def create
FasterCSV.parse(params[:ingredient], {:headers => false, :quote_char => '"', :col_sep => ','}).each do |row_data|
new_record = Ingredient.new('name' => row_data[0])
new_record.save
end
I want to apply the final thing to a model with multiple columns hence the col_sep