Such a cute little helper

With all the hard work going about, I only just recently noticed this cute litte helper. A helper function named ‘dom_id’ will turn any ActiveRecord model into a handy string that everyone uses to identify DOM ids.

Here’s an example that PHP-ers will surely recognize.


<div id="bookmark_<?=$bookmark->id?>">

This technique is used all the time to identify multiple records on one html page. It turns out that Rails 2 has Simply Helpful’s cute little helpers on board! So instead of that thing above, you just write this:


<div id="<%=dom_id(bookmark)%>">

Ahhh. Much better.

0 Responses to “Such a cute little helper”


  1. No Comments

Leave a Reply




About Bemba Media

Bemba Media is a new social media company based in Amsterdam, the Netherlands. Founders Aaron Peters and Arne Dibbits are on a mission to offer people the easiest way to share their web experiences with friends and to discover what’s hot on the web right now.

The company launched Bemba.com in March 2008.

Bemba users share their favorite videos and websites on the social platforms they already use with their friends, like Facebook, Twitter and Hyves. More social networks and (micro-) blogs will follow.

Bemba will become a destination for 'funsurfing' the web, providing easy access to web content that people with similar interests have recently recommended to their friends.

Flickr photos

meeting with Sanoma NL in Hoofddorp #

Bemba blog in Wordle

More Photos

Twitter updates

    Recent readers