In Formtastic 2.x, semantic_errors ALWAYS includes: base.
However, I noticed in Rails 3 (I'm in Rails 3.2) that error messages from validation are no longer stored on the database, but stored by attribute. For example, with this class:
class User < ActiveRecord::Base
Your @ user.errors object when creating / updating fails will look like this:
#<ActiveModel::Errors:0x0000000 @base=#<User id:1, name: "">, @messages={:name => ["can't be blank"]}>
If you want to make your form as follows, it will throw an error for the name attribute.
<%= semantic_form_for @user do |form| %> <%= form.semantic_errors :name %> ...main body of form... <% end %>
This is an example layout, but you understand what I mean.
Unfortunately, there is currently nothing in formtastic codebase that supports the "all" option with Rails 3 (again, I am using Rails 3.2)
Ben evans
source share