Displaying/Editing data fields shortcut?

I have several pages of data (Customer address info, etc) that I want to minimize the code I have to write to display & edit the fields.

I thought of pointing show and edit to the same view, so they use the same html layout. The only difference, is that the text fields are wrapped in a helper

function that looks are the controller action to determine if the field is displayed as text, or is an editable item.

Would this be considered too much of an ugly hack?


def tfMacro(cl, member, text, options = {})

(controller.action_name =~ /edit|new|dup/)? (text_field cl, member, options) : “#{text}