Testing Rails controllers communicating with external web services

As I was writing the code to accept payments through Paypal for MyOwnDB, I kept wondering how I could write functional tests to validate it. All those methods initiate or react to communications with Paypal, and although there's a sandbox available, you cannot predict the id assigned to the transactions and that must be returned to Paypal (see below for how this validation works)., This clearly limited the scope of the tests I could write.

Google sitemap for Ruby on Rails website

I was building a Google site map for using their generator (in python). Using the generator is very easy: just edit the config file according to the comments included the example. You can configure the generator to analyze access logs of your webserver to extract URLs to put in the sitemap.

Rails and Paypal's Payment Data Transfer

When you use Paypal to get payments, you can configure a return URL to which the payer will be redirected. When you activate Payment Data Transfer, you get some information about the payment that redirected to your site. The paypal gem (more info at leetsoft, although the doc you'll find there is out of date) doesn't work with Payment Data Transfer, but only with Instant Payment Notification (notification made separately by Paypal making a post request to your server).

Eating my own dogfood with public forms

There's a feature in MyOwnDB that was there from the start, but maybe not publicised enough: you can publish a entry form for each of your tables. And in this form, you get all data validation! No bogus email will make it in your database! (well, email validation is regexp based, so it's not 100% safe, but it'll limit the errors). And I'm using this functionality in the contact page at

Ruby on Rails and multi-lingual sites

There's no internationalisation integrated in Ruby on Rails, but it is very easy to develop websites in multipple languages with it. I'll post here how I did translate the error messages generated by ActiveRecord validation rules At first, warning: I'm using an as yet unreleased translation plugin. The reason it is not yet available is that I haven't had time to package it right. I have a controller used to manage the translations, and I haven't had the time to really look for a solution to package it in the plugin.
Syndicate content