Cameron Yule

Mailbuild gem 1.1.1 release

I pushed an update to the Mailbuild gem this morning in response to a bug report from Michael Larocque, who found it wasn’t properly defaulting to the first List ID if none was specified explicitly.

Full details can be found in the commit on the github mirror.

Published on November 7, 2008 in Programming
Comments Off

Rails 2.1 YUI Uploader Example

I’ve finally committed my Rails 2.1 YUI Uploader example, which is a fully-functioning Rails 2.1.2 application demonstrating the use of YUI Uploader, attachment_fu, CSRF protection and the Restful Authentication plugin. It’s using the latest 2.6.0 release of YUI, which includes the fixes to the the Uploader for Flash Player 10.

It’s up on Github now, all the details you’ll need are in the README.

Published on October 30, 2008 in Programming
5 Comments

SWFUpload demo update

I’ve updated the Rails 2.1 SWFUpload example to use the new 2.2.0 Beta 2 release of SWFUpload. The reason for the new release is that there were security changes in Flash Player 10 which prevent JavaScript from causing Flash to show a file dialog – the browse button is now rendered by Flash itself.

Published on October 30, 2008 in Programming
2 Comments

Polymorphs ‘is not a taggable model’

I’ve been having an issue with Has Many Polymorphs tagging functionality where I was getting a "Model is not a taggable model" error while using the tagging methods.

As I’m not alone in having this problem, here’s a quick fix.

At the bottom of environment.rb;

require 'tagging_extensions'
require 'tag'

Published on October 27, 2008 in Programming
1 Comment

Rails staging environment

It’s easy to forget that Rails isn’t limited to the default development, test and production environments and I’ve found a custom staging environment comes in useful.

A staging environment is identical to production in terms of caching and performance, but allows you to target configuration settings for testing on your live server.

The common use case for me has been commerce applications where you can use the staging environment to automatically switch to your payment provider testing account while everything else is as per production.

Here’s how you can get a staging environment up and running.

  1. Copy production.rb to staging.rb in config/environments
  2. Add a staging entry to your config/database.yml
  3. Assuming your staging DB exists, that’s it!

You can then test it out with mongrel

ruby script/server -e staging

or alternatively if you use Phusion Passenger (mod_rails)

<VirtualHost XX.XX.XX.XX:80> 
  …
  RailsEnv staging  
</VirtualHost>

Published on October 26, 2008 in Programming
1 Comment