I've got an app close to ready as version 1, but client wants labels
on a form and corresponding column names in the database changed, e.g.
the label/column named "purpose" to "description".
I've got a form defined in app\views\expenses\new.html.erb with a
field defined as:
<%= f.label :purpose %><br />
<%= f.text_field :purpose %>
Of course the name "purpose" appears, among other places, also in
<% @expenses.each do |expense| %>
<td><%=h expense.purpose %></td>
In short, can I make changes like this:
1. simply through the "change" mechanism of migration -or-
2. with a Ruby program to make case-sensitive changes in all files
with names ending in .rb or .html -or
3. some other way aside from manually?
You could also just leave the database column and change the visible labels. That works if the field really is the 'purpose', but can get confusing down the road to remember to label it as 'Description'.
If you're going to change it, change the column using a migration.
And *manually* change all the occurrences of it. "grep -ri purpose *" will find all the instances of it. You don't want to do it programmatically because you might very well end up changing the sentence "the purpose of the description is to" to "the description of the description is to" which isn't what you want.
Of course, if you see reasonable patterns in the output of grep by all means do some magic on them... for example maybe...
perl -i -p -e 's/:purpose /:description /g' file1 file2 file3
perl -i -p -e 's/\.purpose /.description /g' ....
perl -i -p -e 's/>Purpose</>Description</g' ....
That right there might get most of them.