You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 starsbestbooks=Book[:rating=>5]bestbooks.eachdo |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 starsbestbooks=Book[:rating=>5]bestbooks.eachdo |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