Search code examples
ruby-on-railsformsviewactivescaffold

How to Override Form Heading or Title in ActiveScaffold


Is there an easy way to override the title on an ActiveScaffold page? I know I can customize the name of the model part, but what if I want to say "Let's make a new widget, shall we?" instead of "Create Widget"? It seems overkill to override the whole template or partial just to get a new heading.

The ActiveScaffold default _create_form_html.erb is

  <% form_action ||= :create %>
  <%= render :partial => "base_form", :locals => {:xhr => xhr ||= nil,
      :form_action => form_action,
      :method => method ||= :post,
      :cancel_link => cancel_link ||= true,
              :headline => headline ||= active_scaffold_config.... } %>

Is there a way to set that headline variable from inside the controller?


Solution

  • Inside the scaffold config write:

    conf.list.label = 'The list label'
    conf.create.label = 'Let's make a new widget, shall we?'