RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Working with Modeled Objects in Merb

Within the scope of a typical Merb application, modeled objects may include users, posts, entries, or comments. Learn how to work 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.

Foy Savas runs Assembly, a Boston-based Web consultancy focused on innovative technology. In the past, he has acted as CTO of a large health and fitness site and as a lead consultant for several white-labeled Web applications. Foy is also one of the earliest adopters of Merb and over the past year has taken several Merb applications, both small and large, into production. Actively involved in the Merb open source ecosystem, he has also been a core contributor to both Merb and DataMapper.
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date