# Naming model attributes using \_id

**URL:** <https://www.ruby-forum.com/t/naming-model-attributes-using-id/184169>\
**Category:** Rails\
**Created:** [February 26, 2010, 1:08am UTC](https://www.ruby-forum.com/t/naming-model-attributes-using-id/184169 "2010-02-26T01:08:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![russianbandit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russianbandit](https://www.ruby-forum.com/u/russianbandit)\
**Post date:** [February 26, 2010, 1:08am UTC](https://www.ruby-forum.com/t/naming-model-attributes-using-id/184169/1 "2010-02-26T01:08:10Z")

</div>

Is it a good idea to name some model attributes (and table columns) by  
prefixing \_id to it?  
For example, an application will collect some transaction ID.  
transaction\_id would be a good name for it, but it will not be  
associated to any other table. What kind of bad doodoo would this cause?

---

<div class="post-metadata">

**Author:** ![russianbandit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russianbandit](https://www.ruby-forum.com/u/russianbandit)\
**Post date:** [February 26, 2010, 6:58am UTC](https://www.ruby-forum.com/t/naming-model-attributes-using-id/184169/2 "2010-02-26T06:58:49Z")

</div>

Hello,

As long as it’s not used in any model relationships i don’t see any  
trouble it could cause.

---

<div class="post-metadata">

**Author:** ![russianbandit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russianbandit](https://www.ruby-forum.com/u/russianbandit)\
**Post date:** [February 26, 2010, 5:02pm UTC](https://www.ruby-forum.com/t/naming-model-attributes-using-id/184169/3 "2010-02-26T17:02:11Z")

</div>

On Feb 25, 7:08 pm, Greg L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ## Is it a good idea to name some model attributes (and table columns) by prefixing \_id to it? For example, an application will collect some transaction ID. transaction\_id would be a good name for it, but it will not be associated to any other table. What kind of bad doodoo would this cause?
> 
> Posted viahttp://www.ruby-forum.com/.

I can’t think of any problems this would cause, but it will likely  
confuse the heck out of the next developer on the project…

–Matt J.
