Paul Sturgess

Using Polymorphic urls and paths to create dynamic routes in Ruby on Rails


~7 years ago by Paul Sturgess on paulsturgess.co.uk articles.
Dynamic named routes in Ruby on Rails are really useful when you want to generate a url but you don't necessarily know which records it will be for. For...

Using rspec to test a named_scope in Ruby on Rails


~7 years ago by Paul Sturgess on paulsturgess.co.uk articles.
When testing a named_scope it's important to test the expected behaviour of the method, not how it's implemented, as this will allow you to re-factor your...

Hosting a ruby on rails blog on Heroku cloud hosting


~7 years ago by Paul Sturgess on paulsturgess.co.uk articles.
I've taken the plunge and moved my site over to Heroku ruby cloud host. My initial impressions of the service are great so I thought I'd post up my experience...

How to install a Ruby on Rails plugin from a specific git repository branch


~7 years ago by Paul Sturgess on paulsturgess.co.uk articles.
Lots of Ruby on Rails plugins are being updated for Rails 3 and thus for older Rails apps you don't always want to install the latest and greatest version...

How to retry a specific queue of failed Resque jobs


almost 7 years ago by Paul Sturgess on paulsturgess.co.uk articles.
Resque has a very handy interface for managing the queue of jobs but it falls short when jobs fail. In order to only retry a specific queue drop onto the...

Installing Capistrano on Ruby 1.8.6 – Abort Trap error


almost 7 years ago by Paul Sturgess on paulsturgess.co.uk articles.
Occasionally when installing gems I'll get an abort trap failure message. Often I've found this means the version of Ruby isn't compatible with the gem...

How to reset the primary key sequence for a table in Ruby on Rails


over 6 years ago by Paul Sturgess on paulsturgess.co.uk articles.
Sometimes when importing data the primary key sequence can get messed up. I've come across this more often with PostgreSQL databases. Anyway, an easy way...

How to set the value of a field directly using Capybara


almost 6 years ago by Paul Sturgess on paulsturgess.co.uk articles.
One of the most obvious ways your website can be attacked is through a form being maliciously tampered with. To cover this scenario in integration tests...