Versatile RESTful APIs Beyond XML

An article I wrote has just been published over at InfoQ. It’s called Versatile RESTful APIs Beyond XML and shows how easy it can be to extend Rails’ RESTful behaviour to input and output resources not only as XML but also as JSON and Microformatted HTML. The article builds on some posts on this blog, such as Intercepting Microformats In Rails Input, but offers a bit more context. The timing of the article fits nicely with a post on the microformats-rest list about Rails, REST and microformats, so hopefully we’ll see more discussion of these concepts over the coming weeks. ...

Rails Geo Plugins: GeoKit

There’s quite a bit of overlap between GeoKit and acts_as_geocodable/graticule, as the latter pair were based on GeoKit. But it provides at least one feature (IP-based location lookup) that they don’t, so I decided to give it a whirl. Since my main geographically related projects are both now based on plugins that I’m pretty happy with and which suit them well, I decided to resuscitate an old sample piece. A few months back I wrote about scraping the Grand Rapids bus routes site and put up a toy application utilising the resource features in then-edge Rails. I’ve been meaning to return to that project to test out some features in ActiveResource, but in the meantime it seemed like it might be useful to be able to search for the nearest bus stop. ...

Extending acts_as_geocodable

After writing my review of acts_as_geocodable/graticule earlier in the week, I decided to go searching for geocoding services that might offer data for addresses outside of North America. One that I came across is at Local Search Maps. There’s an introductory blog entry here. The API is a little different in that it returns its data as javascript strings, but otherwise it’s simple enough to send a GET for a given address and get back the data. To see how easy it is, I decided to code up an extra geocoder for graticule that would use this service. ...

Rails Plugins: attachment_fu

I’ve used Rick Olson’s excellent acts_as_attachment on a number of projects and it’s saved me a huge amount of time that would have been spent worrying about how best to resize images, how to make sure uploaded files are properly written to storage, and other such boring details. So I’ve been noticing with interest increasing references to his new attachment_fu plugin, which is a complete rewrite of acts_as_attachment. That interest was piqued as I skimmed this nice how-to on file attachment from Mike Clark (if you’re just looking for how to get started, go read that). It seems attachment_fu is almost entirely backwards compatible with acts_as_attachment (you just need to change your models to rename the ‘acts_as_attachment’ declaration ‘has_attachment’), but with a number of enhancements. ...

Rails Geo Plugins: acts_as_geocodable

acts_as_geocodable ( blog entry, repository) is the newest kid on the rails geo plugin block. It actually consists of two parts, a gem called graticule which handles the actual geocoding, interacting with external services, etc, and the plugin which offers extensions to your models. I like that separation. Having the generalised code in a gem and the rails-specific hooks in a plugin makes a lot of sense and makes it much easier to use the core code in non-rails ruby apps, and having a single gem that supports multiple services allows for built-in failover should the preferred geocoder be unavailable. ...

Comparing rails geo-plugins

There seems to be quite a plethora of Ruby/Rails libraries appearing aiming to simplify handling geography and distances. In some cases these libraries do quite distinct things (zip codes vs. longitude/latitude, map output vs. distance calculations) but they’re frequently lumped together and it’s difficult to tell which will be best to use in your projects. I’ve used several of these projects and have previously blogged about YM4R and acts_as_locateable, but I’m still not sure which I’d pick for new projects. So I thought it would be helpful to try to put together a comparison of which libraries offer what functionality. Here I’ll just offer a quick chart, but I’m hoping to write them up in a bit more detail over the coming days/weeks. If there’s sufficient interest, I’d consider moving this out to a wiki for more general use. ...

Rails Hosting Comments: 1&1

While one of the most popular posts on this blog is the instructions I wrote up for compiling and installing Ruby and Rails at 1&1, I never actually got as far as deploying a full application there. I was helping a friend admin that server and hosting a few sites there that we work on together. We’ve got a rails app or two in the works, so I wanted to be ready, but I was never entirely comfortable with the idea of hosting there. ...

Rails Hosting Comments: Textdrive

Like many others, the first place I hosted a rails application was at textdrive, and I was very pleased to finally find a shared hosting company that respected the fact that I have some understanding of how a server is configured. It’s not that I can’t administer my own server, but I have other priorities and am very happy to pay someone else to do the job better than I could. I leapt at the chance to get a lifetime hosting account, and have a number of sites, including this blog, hosted there. ...

Rails Hosting Comments: Site5

I’ve used Site5 for a couple of PHP sites, and they were one of the earlier entrants onto the rails hosting scene, so when I recently needed to find hosting to recommend to a new client they seemed worth a try. Like dreamhost, about whom I wrote a few days ago, they use a basic apache/fcgi setup for serving rails applications, but so far it’s felt like processes can be killed a bit more reliably, making deployment a little easier than it is at dreamhost. I’ve not really pushed the servers, but they’ve seemed pretty responsive so far. This is another app which can be fairly heavily cached, so that helps. ...

ActiveMerchant

By far the most popular (and most versatile) plugin for working with payment gateways from rails is ActiveMerchant. I’ve used it in a couple of places, and it’s been a joy to work with, apart from one slip-up which was largely due to inadequate documentation. So I’m very pleased to note that they’ve release their 1.0 and launched a website, which bodes well for improved documentation and support.