Deleting table data from staging table

I have this:
imports_controller:

def process_csv
# First thing, clear "Imports" table of data
@import = Import.find(:all)
@import.destroy

Just use Import.delete_all, provided you do not need any callbacks etc.
destroy only works on a single record, you are trying to use it on an
array. You would have to do
@import.each {|i| i.destroy} or similar

Colin

Colin,
I used the array approach and it worked.

Like this...
@import = Import.find(:all)
@import.each { |i| i.destroy }

Thanks for the input.

John

Colin Law wrote: