# Renaming/overiding table column names

**URL:** <https://www.ruby-forum.com/t/renaming-overiding-table-column-names/90353>\
**Category:** Rails\
**Created:** [March 28, 2007, 2:18am UTC](https://www.ruby-forum.com/t/renaming-overiding-table-column-names/90353 "2007-03-28T02:18:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![georgeuoa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7ab992/32.png) [@georgeuoa](https://www.ruby-forum.com/u/georgeuoa)\
**Post date:** [March 28, 2007, 2:18am UTC](https://www.ruby-forum.com/t/renaming-overiding-table-column-names/90353/1 "2007-03-28T02:18:45Z")

</div>

Hello G.s!

Please i wish to know how can i change database column names dynamically  
at run time.  
Say i have a legacy database and some of the column names are not  
meaningful to the user. for example i have a column named  
“timeaccessioned” ; the user wants to see “recording date”, so it makes  
sense to have to change that at run time particulary if am using a  
method like column.human\_name to send the column data to the views.  
Any one who has encountered this and has an idea how to overide the  
database column names during runtime?

Thanks

---

<div class="post-metadata">

**Author:** ![georgeuoa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7ab992/32.png) [@georgeuoa](https://www.ruby-forum.com/u/georgeuoa)\
**Post date:** [March 28, 2007, 2:27am UTC](https://www.ruby-forum.com/t/renaming-overiding-table-column-names/90353/2 "2007-03-28T02:27:37Z")

</div>

1. Let go of scaffolding and it’s “one-size-fits-all” content\_columns.  
Embrace getting a little dirty with ERb and Rails.
2. Simply alias the attributes in question. alias\_attribute is your  
friend  
there!

Actually you don’t have to do number one there but getting rid of those  
scaffolding training wheels is a good thing. You gain a lot more control  
over what you can do and how it looks. Hope that helps.

RSL

---

<div class="post-metadata">

**Author:** ![georgeuoa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7ab992/32.png) [@georgeuoa](https://www.ruby-forum.com/u/georgeuoa)\
**Post date:** [March 28, 2007, 3:28am UTC](https://www.ruby-forum.com/t/renaming-overiding-table-column-names/90353/3 "2007-03-28T03:28:07Z")

</div>

Russell N. wrote:

> 1. Let go of scaffolding and it’s “one-size-fits-all” content\_columns.  
> Embrace getting a little dirty with ERb and Rails.
> 2. Simply alias the attributes in question. alias\_attribute is your  
> friend  
> there!
> 
> Actually you don’t have to do number one there but getting rid of those  
> scaffolding training wheels is a good thing. You gain a lot more control  
> over what you can do and how it looks. Hope that helps.
> 
> RSL

Thanks Russell for pointing the way. Actually am letting go scaffolding  
and wants to roll in mud with ERb and rails!

---

<div class="post-metadata">

**Author:** ![georgeuoa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7ab992/32.png) [@georgeuoa](https://www.ruby-forum.com/u/georgeuoa)\
**Post date:** [March 28, 2007, 4:31am UTC](https://www.ruby-forum.com/t/renaming-overiding-table-column-names/90353/4 "2007-03-28T04:31:47Z")

</div>

It’s a bit harder than scaffolding but the payoffs are totally worth any  
effort you spend. Rails/Ruby is like a gift that keeps on giving.

RSL
