# Activerecord attribute without db column

**URL:** <https://www.ruby-forum.com/t/activerecord-attribute-without-db-column/95737>\
**Category:** Rails\
**Created:** [June 11, 2006, 6:10pm UTC](https://www.ruby-forum.com/t/activerecord-attribute-without-db-column/95737 "2006-06-11T18:10:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7ea924/32.png) [@Matias](https://www.ruby-forum.com/u/Matias)\
**Post date:** [June 11, 2006, 6:10pm UTC](https://www.ruby-forum.com/t/activerecord-attribute-without-db-column/95737/1 "2006-06-11T18:10:48Z")

</div>

Hi,

I’ve a model that is stored to the db, but just one of its atribbutes  
doesn’t have a corresponding column on the table (it is used just for a  
calculation and still requires validation).

I’ve been succefull by doing what is explained in  
[http://rails.techno-weenie.net/tip/2005/11/19/validate\_your\_forms\_with\_a\_table\_less\_model](http://rails.techno-weenie.net/tip/2005/11/19/validate_your_forms_with_a_table_less_model)

But I get an error of a non-existent column for the attribute I don’t  
want  
to store.

Any idea?

Thanks everybody

---

<div class="post-metadata">

**Author:** ![Matias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7ea924/32.png) [@Matias](https://www.ruby-forum.com/u/Matias)\
**Post date:** [June 11, 2006, 8:23pm UTC](https://www.ruby-forum.com/t/activerecord-attribute-without-db-column/95737/2 "2006-06-11T20:23:41Z")

</div>

In the model, use:

attr\_accessor :attribute\_name

–  
– Tom M.
