rails import csv data from dynamic url -
i'm newbie ror. i'm trying import data asp url: i've ticket passed url returns informations time_created, time_updated, owner, notes. i've tried putting code in view:
<% file = open("http://xxx.xxx.xxx/utility/ticket_dettagli.asp?tt="+@ticket.ticket) %> <%= csv.new(file, col_sep: ',').readlines |row| %> <%= ticket.create! row.to_hash %> <% end %>
without success...any suggestion?
why trying in view? think, there should rake task import tickets form csv or class method in model ...
see: http://railscasts.com/episodes/396-importing-csv-and-excel
@ticket
- variable? how declare it?
Comments
Post a Comment