Main Content

Decently Exposing Your Views and Controllers

About the Talk

April 17, 2010 5:45 AM

Michigan State University, Lansing, MI

Michigan State University, Lansing, MI

By far the most common means of making data available inside your Rails views--be they ERB or HAML--is by setting up instance variables inside your controllers. Although Rails makes this dead-simple for you, in reality it breaks encapsulation and leads to a spaghetti-like interleaving between two ostensibly seperate portions of the MVC stack. Enter decent_exposure, a lightwieght gem written at Hashrocket that is intended not only to clean up how data shows up in your views, but to simplify your controller logic as well. Incorporating lazy loading, memoization, and a super-tight implementation, decent_exposure represents a useful new Rails idiom. We'll discuss how it works, how it's written, and how to use it in your own apps.

Ratings and Recommendations

Avg. Rating

Average based
on 9 ratings

comments powered by Disqus