Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

nicholas maddren
nicholas maddren
12,793 Points

CSV to Database Example?

Hello community, I need to add a function to my site that imports a CSV file into a mysql database. When the CSV file is updated I want ruby to update the database like a cron job. I am unfamiliar with Ruby and someone has told me Ruby will best fit this function. The CSV contains car information here is an example:

http://content.screencast.com/users/nickmadd/folders/Jing/media/d0cab4fc-2c1b-45bd-8c21-71f22a39cfc6/2014-06-26_2035.png

I am unsure how it will read the CSV because the first column is the header that explains the values of each row.

Any advice on this would be great. I am going to display the vehicle information in an ecommerce inventory list on the front end of my site.

Could someone show me a bit of example code that would work for my needs?

Thanks