DEV Community

Discussion on: Import CSV data to Ruby on Rails 7

Collapse
 
danhorst profile image
Dan Brubaker Horst

👋 thanks for the write up!

Your example uses a CSV with headers so you can pass the headers: true argument to CSV.parse. This let's you simplify your iterator logic and allows you to use names rather than indeicies when accessing row values which helps decouple the code from the structure of the data (there's more that you can do with this too).