Hey Phil,

One more question: I should only make changes in .rb and .erb files
subordinate to the app directory, right?

Thanks again,
Richard

On May 13, 4:27 pm, Philip Hallstrom <[email protected]> wrote:
> > 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
> > app\views\expenses\index.html.erb
>
> > <table>
> >  <tr>
> >    <th>Purpose</th>
> >       [snip]
> >  </tr>
>
> > <% @expenses.each do |expense| %>
> >  <tr>
> >    <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' ....
> etc...
>
> That right there might get most of them.
>
> -philip
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to