YAML FAQs plugin

I've just released my first rails plugin - yaml_faqs

It's a modest little number that adds yaml-based FAQs to your rails apps.

Hope people find it useful.


Rails2 and boolean radio buttons

Just came across a difference in the way rails 2 handles radio buttons, compared with rails 1, and I don't think I've seen it documented anywhere.

If you've got something like this;

<% form_for(@hello) do |f| %>
<p> <%= f.radio_button :foo, true %>True </p>
<p> <%= f.radio_button :foo, false %>False </p>
<p> <%= f.submit "Create" %> </p>
<% end %>
Then, if you click on the "True" radio button, and submit the form, you get;
...submitted to your controller. All fine.

Now, click on the "False" button and submit, and you get;
Not quite so good. This can really mess you up if your controller method has something like;
if params[:foo] == "false"
... do something cool
Do the same thing in Rails 1.2.6 and you get;
The moral of the story? Do this instead;
<% form_for(@hello) do |f| %>
<p> <%= f.radio_button :foo, "true" %>True </p>
<p> <%= f.radio_button :foo, "false" %>False </p>
<p> <%= f.submit "Create" %> </p>
<% end %>
i.e. Use string values, not logical values, in the view file. This works fine in either version.


London Ruby User Group

I was among several people to give a 20x20 presentation at the London Ruby User Group on Monday.

Great fun, albeit slightly nerve-wracking. Particularly when I ended up going first, and Muz's screensaver came on halfway through my presentation!