I’m using the following _form.rhtml layout for a number of pages,
including edit record and new record (which each has it’s own definition
in the controller).
I’d like to display a different author form field depending on which
page they are using. I’d rather keep using _form.rhtml as a layout
template, instead of customizing each separate page.
How do I go about setting up the if statement? Is there such a thing as
a ‘if action => new’ or ‘if action => edit’ statement?
<%= text_field 'article', 'title' %>
<%= text_area 'article', 'body' %>
#if new record page, insert the logged in users name
text_field ‘article’, ‘author’, ‘value’ => @username.name,
‘disabled’ => ‘disabled’
#if existing record to edit page, just display the name already in
text_field ‘article’, ‘author’