Ruby and Databases

B

Brian Ross

[Note: parts of this message were removed to make it a legal post.]

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.

Brian
 
A

Avdi Grimm

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top