Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

riaw's Profile

GitHub User: riaw

Comments by

Avatar

After import I need to populate one of the columns with the foreign key so that I can associate each row uploaded from the file with the user that uploaded it. However, the foreign key (restuarant_id) is stored in a session when the user logs in. seeing that I can't or should't access sessions in the model, how do I accomplish this?

Avatar

Do you mean that it adds the same data in the file again instead of updating? If so, Change the find_by in the model to another field instead of id. For me, I use first name & last name seeing as this would not be one of the changes made to the uploaded file.