Forum: Ruby on Rails CSV Import with Nested Set problem

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.
Rnew B. (Guest)
on 2009-01-12 09:23
Hi all,

Am struggling to get this to work:

I am importing CSV file into the database.

This is my code

def import

      file = params[:import][:file]

        FasterCSV.parse(file, :headers => true) do |food|

          import_this_row = {:id => food[0],
                     :recipe_name => food[1],
                     :recipe_id=> food[2],
                     :reference => food[3],


              @recipes =!

The problem comes with recipe_id where I am using awesome_nested_type
and in the csv file I have this under the recipe_id rows:
Food|Beverages|Pineapple Shake

Now when I import I need to get the id of the recipe_id after reading
the name mentioned in the row.

Could anyone please guide me with this...


This topic is locked and can not be replied to.