# Rails DOM naming conventions?

**URL:** <https://www.ruby-forum.com/t/rails-dom-naming-conventions/149562>\
**Category:** Rails\
**Created:** [September 26, 2008, 9:04am UTC](https://www.ruby-forum.com/t/rails-dom-naming-conventions/149562 "2008-09-26T09:04:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidtl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/35a633/32.png) [@davidtl](https://www.ruby-forum.com/u/davidtl)\
**Post date:** [September 26, 2008, 9:04am UTC](https://www.ruby-forum.com/t/rails-dom-naming-conventions/149562/1 "2008-09-26T09:04:20Z")

</div>

When I’m making views in Rails I am using my own naming conventions for  
dom id’s and classes:

## Ruby on Rails

Lorem ipsum dolor sit amet.

 ... 

I’ve been trying to Google a little around, trying to find an answer,  
but are there any official or semi-official naming conventions for id’s  
and classes in the view out there?

Or is it more like a personal preference?

---

<div class="post-metadata">

**Author:** ![davidtl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/35a633/32.png) [@davidtl](https://www.ruby-forum.com/u/davidtl)\
**Post date:** [September 26, 2008, 9:13am UTC](https://www.ruby-forum.com/t/rails-dom-naming-conventions/149562/2 "2008-09-26T09:13:18Z")

</div>

On Sep 26, 8:04 am, David T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> ```
> ...
> 
> ```
> 
> I’ve been trying to Google a little around, trying to find an answer,  
> but are there any official or semi-official naming conventions for id’s  
> and classes in the view out there?

Perhaps you are looking for the dom\_id, dom\_class, div\_for helpers ?

Fred

---

<div class="post-metadata">

**Author:** ![davidtl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/35a633/32.png) [@davidtl](https://www.ruby-forum.com/u/davidtl)\
**Post date:** [September 26, 2008, 10:36am UTC](https://www.ruby-forum.com/t/rails-dom-naming-conventions/149562/3 "2008-09-26T10:36:01Z")

</div>

Frederick C. wrote:

> > ï¿½ ï¿½ …  
> > ï¿½
> > 
> > I’ve been trying to Google a little around, trying to find an answer,  
> > but are there any official or semi-official naming conventions for id’s  
> > and classes in the view out there?
> 
> Perhaps you are looking for the dom\_id, dom\_class, div\_for helpers ?

These are not conventions. They’re after all just helper methods. But  
it’s right that they’re keeping some conventions when it comes to naming  
id’s and classes too.
