Ruby

geocoder forked & uploaded to github

Tags: 

For a Rails project I'm working on I started using the geocoder gem for zipcode validation. Unfortunately the release that was available via gem was flaky and would often crash if you queried for just a zipcode instead of a full address. With some digging around I discovered that the code in its subversion repository had some fixes applied that hadn't been pushed out to the gem, and after testing them it sure enough was much more robust. Well, this sounded like an excellent use of github! So what I've done is uploaded the SVN code to a new project, I've updated the version number and marked it as available for downloading as a gem. Go git some geocoder goodness!

Cleanly install RMagick on OSX Leopard

Tags: 

Apple's latest Mac OSX release, 10.5, dubbed "Leopard", does a great job to remedy the problem Rails developers had with previous releases - Ruby is now installed and works correctly, with Rails and a whole bunch of other common gems installed too. Awesome stuff. The one thing they missed, however, was the graphics manipulation package RMagick, but thankfully OnRails.org has put together a tutorial for installing RMagick that covers everything needed to get it working.

Making a form reset button in Rails

Tags: 

Rails doesn't have reset_tag to automatically make a form reset button, instead you have to take a slightly different route. To make a form reset button in Rails you simply do this:
[source:ruby]
'reset', :id => 'reset_button', :type => "reset" }) %>
[/source]
which will create the following:
[source:html]

[/source]
The important part here is the :type argument, which override's Rails' default of "submit" for the submit_tag. Then, to tidy it up a little I override the :name, which defaults to "commit", and give it a useful id attribute.

Et voila!

Pages

Subscribe to Ruby