updateactions when a model validation fails. A list of instructions for the client browser will be prepared and dispatched via a persistent websocket connection.
divthat will wrap your input element along with any labels and error messages. It will have an id attribute that will allow Optimism to route any validation errors to the correct place. When a validation failure occurs, this
divwill have an error class added to it, allowing a style cascade to change the visual appearance of the input element and the error message.
spanthat you place adjacent to your your input elements. It will have an id attribute that will allow Optimism to route any validation errors to the correct place. When a validation failure occurs, this
spanwill have the error message injected into it. It is typically hidden unless there is a message present.
rake optimism:installsetup task. Good enough to get you up and running in development, you will need to pull your desired identifier from the context Optimism is running in and let the
OptimismChannelcall the shots. Find out more on the authentication page.
posts_form(following the simple pattern resources_form). If form_class is set to false or nil, no CSS class will be applied.
posts_submit(following the simple pattern resources_submit), your Submit button will be disabled if there are validation errors. It will also be re-enabled if the validation errors are corrected. Only use this if you are working with in-line validations or else your users will lose the ability to Submit your form more than once.
emit_eventsproperty to true in your initializer, Optimism will emit DOM events in response to validation errors. This can happen in addition to or instead of CSS and text updates. This is a great alternative for complicated integrations where you have legacy components which need to be notified of error conditions on the backend.
posts. Attribute is hopefully self-explanatory. Text is the text content of the validation error message.