From: Avdi Grimm Date: 2008-08-18T12:37:56+09:00 Subject: Re: Ruby and Databases On Sun, Aug 17, 2008 at 11:20 PM, Brian Ross wrote: > Is there a book or another collection of suggested readings for learning how > to manipulate a database with ruby? I've gotten to the point where I can > take a CSV file, store it as an associative array, but now I'd like to take > that and put it into a database (postgresql). Is there a sample of commented > code to take a look at? Otherwise, I'm happy to read a few books or articles > and piece what I need together. These days perhaps the most common way to deal with databases in Ruby is using the ActiveRecord library (http://ar.rubyonrails.com/), which originated as part of the Rails web framework. You will find loads of ActiveRecord documention both on the web and in any book about Rails. That's not the only way, however. There are other Object-Relational mapping layers (ORMs), such as DataMapper (http://datamapper.org/). If you're not necessarily looking for an ORM, you just want to manipulate databases from Ruby, you might look into Sequel (http://sequel.rubyforge.org/). Or, if you want to take a more traditional approach, Ruby-DBI (http://ruby-dbi.rubyforge.org/) is one of the most mature Ruby/database libraries. -- Avdi Home: http://avdi.org Developer Blog: http://avdi.org/devblog/ Twitter: http://twitter.com/avdi Journal: http://avdi.livejournal.com