devxlogo

Working with Modeled Objects in Merb

Working with Modeled Objects in Merb

he new Merb MVC framework offers developers exceptional scalability, agility, flexibility, and performance, particularly developers who have been working with Ruby and Rails. In The Merb Way, author Foy Savas has written a comprehensive guide to using, extending, and deploying Merb. The book covers everything developers need to know to build production-quality Merb applications, offering code examples to jumpstart virtually any project.

Within the scope of a typical Merb application, examples of modeled objects may include users, posts, entries, or comments. These objects are most often persisted in a database through the use of an object-relational mapper (ORM). The default ORM included as part of the standard Merb stack is DataMapper, an ActiveRecord-like ORM that aims to push the boundaries of object/data interaction even more significantly toward the object side.

Chapter 5 of The Merb Way shows you how to work with modeled objects in Merb. Given its acceptance as part of the standard Merb stack, the chapter covers the use of only DataMapper. However, as agnosticism is central to Merb’s design, application developers are free to integrate whatever Ruby ORM they may need. For example, you can use ActiveRecord, Sequel, or any of the other options; each of these ORMs is capable of creating, retrieving, updating, and deleting persisted data and is fully supported by the Merb core.

Read an excerpt of “Chapter 5: Models” from The Merb Way.

Editor’s Note: This excerpt is from the new book, The Merb Way, authored by Foy Savas, published by Addison-Wesley Professional as part of The AW Professional Ruby Series (informit.com/ruby), ISBN 0321606388, Copyright 2009 Pearson Education, Inc. Safari Books Online subscribers can access the book here: http://safari.informit.com/9780321601636.

devx-admin

Share the Post: