Paul Sturgess

How to format dates in Ruby on Rails


~12 years ago by Paul Sturgess on paulsturgess.co.uk articles.
To format dates in Ruby you can use the strftime directive that makes up part of the Ruby base library. For example I used... to output March 2006...

Using routes.rb to help you structure your Ruby on Rails app


~12 years ago by Paul Sturgess on paulsturgess.co.uk articles.
Routes.rb is a really powerful and one the most impressive features of the Rails framework once you work out how to use it. Flat pages Rather than using...

A footer that stays at the bottom of the browser window


~12 years ago by Paul Sturgess on paulsturgess.co.uk articles.
The footer on this site will always be at the bottom of the browser window, unless the content is longer than the window height. In which case it will just...

Printing the alphabet easily in Ruby on Rails


~12 years ago by Paul Sturgess on paulsturgess.co.uk articles.
It's really easy to print out the alphabet with Ruby. I needed to do recently as an additional method for searching by letter. Although, I could see it...

Tagging with Ruby on Rails


~12 years ago by Paul Sturgess on paulsturgess.co.uk articles.
Large credit goes out to The Rails Diary for helping me get the tags going on this site. I wanted a many to many relationship between the aritcles and...

Spring CSS Reboot - Out of the dark and into the light


~12 years ago by Paul Sturgess on paulsturgess.co.uk articles.
Hopefully you should be seeing my new look and feel as part of the Spring CSS Reboot. The dark colour scheme of old has not gone forever; I have plans...

Getting Ruby on Rails running on Bluehost


~12 years ago by Paul Sturgess on paulsturgess.co.uk articles.
Getting my site working on Bluehost wasn't entirely straight forward but now it's running there shouldn't be any more difficulties. If you're attempting...

How to pass an instance variable to a rendered partial in Ruby on Rails


~12 years ago by Paul Sturgess on paulsturgess.co.uk articles.
Passing a variable to a partial means you can be clever about re-using your code to output different collections of data in the same way. Essentially you...

How to specify the number of decimal places displayed in Ruby on Rails


~12 years ago by Paul Sturgess on paulsturgess.co.uk articles.
The sprintf Ruby class provides the ability to specify the number of decimal places to display. sprintf("%.1f",track.ratings.average('rating')) In this...

paulsturgess.co.uk relaunch


~12 years ago by Paul Sturgess on paulsturgess.co.uk articles.
A re-build was on the cards for a while and, all in all, it's taken a few months to get this site up and running. Initially I had planned a php based site...