gregbell/active_admin — pull request #905 by robdiciuccio (2012-01-13 19:32:26+00:00)
Title: Form DSL support for formtastic's semantic_errors method

Per [formtastic docs](https://github.com/justinfrench/formtastic/blob/master/lib/formtastic/helpers/errors_helper.rb) [semantic_errors]:

Generates an unordered list of error messages on the base object and optionally for a given set of named attribute. This is idea for rendering a block of error messages at the top of the form for hidden/special/virtual attributes (the Paperclip Rails plugin does this), or errors on the base model.

A semantic_errors passthrough method was added to the ActiveAdmin::FormBuilder DSL, as well as basic CSS for display of the error messages.

Errors can be displayed at the top of the form by including the semantic_errors method. To display all model errors:

```ruby
form do |f|
f.semantic_errors *f.object.errors.keys
f.inputs
f.buttons
end
```

This is particularly useful when you have missing required nested attributes, for which no inline error messages are displayed:

```ruby
form do |f|
f.semantic_errors *f.object.errors.keys
f.inputs
f.inputs "Locations" do
f.has_many :locations do |loc|
loc.input :address
loc.input :_destroy, :as => :boolean, :label => "Delete"
end
end
f.buttons
end
```