Using Judge with SimpleForm

Following on from my previous post about Formtastic, there’s now a Judge extension gem for SimpleForm too.

It’s an almost identical affair.

Install

gem "judge-simple_form", "~> 0.1", :require => "judge/simple_form"

Read here why the require option is necessary.

Update: Bundler 1.1 was released, so the require option is no longer necessary.

gem "judge-simple_form", "~> 0.1"

Usage

Add :validate => true to the inputs you want to validate on the front-end.

<%= simple_form_for(@user) do |f| %>
  <%= f.input :name, :validate => true %>
<% end %>

Feedback

If you’re a regular SimpleForm user and you have any ideas about how to improve on this, I’d love to hear from you.