Paul Sturgess

Select and collect with conditions in Ruby on Rails


over 11 years ago by Paul Sturgess on paulsturgess.co.uk articles.
I really needed an option collection for a select box with confitions. In my case it needed to list vacancies people could apply for, but only if the vacancy...

Debugging tips in Ruby on Rails


over 11 years ago by Paul Sturgess on paulsturgess.co.uk articles.
There are quite a few different ways to go about analysing application errors in Ruby on Rails. I know when I first started out I found the error messages...

Running Ruby on Rails on OS X with Mongrel and MySQL


over 11 years ago by Paul Sturgess on paulsturgess.co.uk articles.
This is not so much an installation guide, but some general notes regarding how I went about getting Ruby on Rails running on Mac OS X 10.4 (Tiger) from...

How to specify multiple layouts within the same controller in Ruby on Rails


over 11 years ago by Paul Sturgess on paulsturgess.co.uk articles.
Using more than one layout in a controller is as simple as placing the following code in your controller: layout :choose_layout private def choose_layout...

How to automatically pluralize text in Ruby on Rails


~11 years ago by Paul Sturgess on paulsturgess.co.uk articles.
To automatically pluralize a word in Ruby on Rails you just neeed to do the following: So you just pass the method a number and the singular word or...

New host, new look and feel, new functionality


~11 years ago by Paul Sturgess on paulsturgess.co.uk articles.
New look and feel Just in time for the new year and a new look site. I've refreshed the design, keeping to the same colours but changing the layout slightly...

How to display the file name of an upload in Ruby on Rails


~11 years ago by Paul Sturgess on paulsturgess.co.uk articles.
Often you want to display just the filename of an upload/attachment that a user has uploaded. Just do the following: File.basename(@vacancy.document) The...

Using blank and compact in Ruby on Rails to help output incomplete data


~11 years ago by Paul Sturgess on paulsturgess.co.uk articles.
Often I want to display a set of address fields, but only show the ones that have been filled in by the user. For example if I have an Applicant with several...

Using MacPorts(DarwinPorts) to install Ruby on Rails, MySQL, Subversion, Capistrano and Mongrel on Mac OS X


~11 years ago by Paul Sturgess on paulsturgess.co.uk articles.
Originally I installed Ruby on Rails on my MacBook by compiling from source, closely following the Hive Logic guide. However, I found that I couldn't deploy...

Deploying two rails apps under the same account using SVN and Capistrano on hostingrails.com


almost 11 years ago by Paul Sturgess on paulsturgess.co.uk articles.
This is a step by step guide of how I setup my SVN repository and Capistrano deploy file on hostingrails.com Please keep in mind this setup is just one...