Forum: Ruby on Rails Processing a CSV file to validity before putting it in the t

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
95b9972ab20ddc8817a46b7b778ab6a1?d=identicon&s=25 Carl Wright (Guest)
on 2007-04-13 18:47
(Received via mailing list)
I'm developing a RoR application that uploads a CSV file, then
validates the entries and allows the user to correct columns from the
CSV file. When everything is valid, the user may post the uploaded
data to the database.

I'm successfully uploading the CSV into an "uploads" table with the
record holding the CSV file content, like uploading a JPG file. I've
created a class that matches the desired results from a CSV line. I
can parse the CSV file in t an array of the class and validate it into
a "/index" display on the browser. At this point I haven't put the
data from the CSV into MySQL. I've got it in an array like you get
from "model".find(:all). I put a link on the uploads panel to take me
to the lines panel to show the parsed CSV fields with validation
messages attached as TITLEs on the table cells.

I'm doing a RESTful implmentation, but running into problems with the
resource paths in link_to.

I'm trying to delay putting the parsed CSV results into MySQL until
it's correct. I've been holding it in the array, but now I'm having
trouble making the array available to the edit method after making the
array in the index method.

1st question: I've been trying to avoid putting info into a MySQL
table until it was validated, but all the scaffolded code and the
resource links want to see the data in the DB. What approach to
handling the validation and then posting of the data do you recommend?
I'm prepared to re-work my efforts into another approach.

2nd: How may I share the array between the methods? How do I get the
link_to to refer to selected line in an /index panel when "edit",
"show", ... are selected?


Ffcf0b655f47afd0bbf3dd7aca8935c8?d=identicon&s=25 Federico Fernandez (fedemart)
on 2007-12-12 22:57
I am trying to do exactly the same thing... did you get an answer in
some other forum?
This topic is locked and can not be replied to.