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:
> 2009/8/26 John Mcleod :
>>
>> I have this:
>> imports_controller:
>>
>> def process_csv
>> # First thing, clear "Imports" ta
2009/8/26 John Mcleod :
>
> 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 r
2009/8/26 John Mcleod :
>
> Hello all,
> I'm using Ruby 1.8.6 and Rails 2.3.3.
> I'm new at Rails so bear with me, please.
>
> My application reads in a csv file to a staging (imports) table then
> compares the contents of the table to a main (projects) table. Then
> imports all non-repetitive row
I have this:
imports_controller:
def process_csv
# First thing, clear "Imports" table of data
@import = Import.find(:all)
@import.destroy
file = params[:import][:file]
rowcount = 0
Import.transaction do
FasterCSV.parse(file,
:headers => true,
4 matches
Mail list logo