Mapping Table Names to Human Names for Display

Using Scaffolding, in SHOWING data, it shows the table name (called the
human name) and valve, when showing data. I would like alter the
table/human name.

Is there an easy way to do this, or should i make my own
mapping hash table?

What?

Shouldn’t it be editable in a view somewhere?
app/views/layouts/your_controller.rhtml or app/views/your_controller/*
to
begin with.

Ryan B. wrote:

What?

Shouldn’t it be editable in a view somewhere?
app/views/layouts/your_controller.rhtml or app/views/your_controller/*
to
begin with.

na.
the EDIT pulls up a form.
the SHOW command grabs the column name.

here is the basic code for a SHOW:

<% for column in Text.content_columns %>

<%= column.human_name %>: <%=h @casefile.send(column.name) %>

<% end %>

I still don’t get what you’re trying to do.

Ryan B. wrote:

I still don’t get what you’re trying to do.

Well, if my sql table, as a column named goofypants,
right now it displays, after scaffolding:

goofypants: ME

i want it to display

Goofy Pants: ME

i was wondering where to change that,
or to make a hash for table name conversion.

Ryan B. wrote:

Aha! Ruby has no way of knowing how to titleize a column name such as
that.
However, if your column was goofy_pants it would not have a problem.
Simply
call column_name.titleize.


Ryan B.
http://www.frozenplague.net

now i feel like goofy.
i wish i had known that.

Aha! Ruby has no way of knowing how to titleize a column name such as
that.
However, if your column was goofy_pants it would not have a problem.
Simply
call column_name.titleize.


Ryan B.
http://www.frozenplague.net

Ryan B. wrote:

That’s ok. We were all noob once. Even matz.

Ryan B.
http://www.frozenplague.net

i converted 6 tables, and it works GREAT.
thanks.

That’s ok. We were all noob once. Even matz.

Ryan B.
http://www.frozenplague.net

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs