Renaming/overiding table column names

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

  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

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!

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