container_for
helper, which wraps a form element in a div
that has an id similar to the error_for
helper, except you're looking at posts_body_container. More importantly, the container receives a CSS class called error that can be used to change the visual characteristics of the error message as well as the input element itself. It is this interplay between cascading style and the order in which the styles are declared that makes this approach work. Consider the following CSS:posts_form
- Optimism will also place an invalid class on the form if there are any errors at all. This gives the developer the flexibility to demonstrate an error state at the form level by tweaking how the form is displayed.params
hash will not include data for it.checkbox
helpers that Rails provides, which implement a clever hack to make sure that unchecked checkboxes produce a false
value in your params
.