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 <[email protected]>:
>>
>> I have this:
>> imports_controller:
>>
>> def process_csv
>> # First thing, clear "Imports" table of data
>> �...@import = Import.find(:all)
>> �[email protected]
>
> 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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---