DWTF Open Source License

November 5, 2008




Scott Raymond’s “Ajax on Rails” contains a nifty trick for form fields, following the Rails mantra of DRY and convention over configuration. Creating a field with an associated label, error checking, and formatting is as simple as

   <%= f.text_field :phone %>

This produces a label using the humanized “Phone: “, a <div> for holding validation errors, an input tag, and appropriate field values. Here’s a complete form using Scott’s hackery from page 298:

<%# See +standard_form+ in application_helper.rb %>
  <%= f.text_field :name %>
  <%= f.date_select :start_date, :label => "First Call" %>
  <%= f.date_select :end_date, :label => "Last Call" %>
  <%= f.text_field :phone %>
  <%= f.text_field :email %>
  <%= f.text_area :body, :label => "Notes" %>
  <%= standard_submit %>
<% end %>

Scott’s magic is embodied in a form helper, LabelingFormBuilder. For yucks, I Googled in search of a Rails plugin by that name. I stumbled across labeling_form_builder from Seth Rasmussen. I peeked at the license. Seth cracked me up. Only in open source can you get away with this (words bleeped):

           DO WHAT THE F**K YOU WANT TO PUBLIC LICENSE
                   Version 2, December 2004

Copyright (C) 2007-2008 Seth Thomas Rasmussen

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

           DO WHAT THE F**K YOU WANT TO PUBLIC LICENSE
  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

 0. You just DO WHAT THE F**K YOU WANT TO.

Leave a Reply