# Broken dom\_id

**URL:** <https://www.ruby-forum.com/t/broken-dom-id/140221>\
**Category:** Rails\
**Created:** [June 12, 2008, 12:58am UTC](https://www.ruby-forum.com/t/broken-dom-id/140221 "2008-06-12T00:58:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrewkendall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b77776/32.png) [@andrewkendall](https://www.ruby-forum.com/u/andrewkendall)\
**Post date:** [June 12, 2008, 12:58am UTC](https://www.ruby-forum.com/t/broken-dom-id/140221/1 "2008-06-12T00:58:32Z")

</div>

In the docs for dom\_id, this is given as an example…

dom\_id(Post.new(:id =\> 45)) # =\> “post\_45”

This doesn’t work and I don’t see how it’s supposed to work. :id is a  
protected attribute, meaning it will be nil.

The example above should always return “new\_post”, not “post\_45”.

Am I missing something here or is this just some bad documentation that  
got in to Rails? I don’t even see this as an example in the test cases.

Thanks,  
Andrew
