ORMs - Ramaze/ramaze GitHub Wiki

ORMs let's you map database entries as collection of ruby objects, and thus gives you some kind of API to your data. For instance, if you have a database of books, using an ORM will let use use instances of Book object. These instances will map directly to rows in your books table.

Here is a pseudo-code (all ORMs do not have the same syntax) example :

# Get an array of the books rated five stars
bestbooks = Book[:rating=>5]
bestbooks.each do |b|
  puts "I just love #{b.title}"
end

ORMs also maps relashionships between table entries. For instance, if your books have an author entry, you could write something like this :

# Get an array of the books rated five stars
bestbooks = Book[:rating=>5]
bestbooks.each do |b|
  puts "I just love #{b.title}, written by #{b.author.name}"
end

Ramaze supports a wide variety of ORMs, but is close friend with Sequel