Wolfmans Howlings

A programmers Blog about Programming solutions and a few other issues

Upgrading a Rails 3 app to the latest Rails 8.x

Posted by Jim Morris on 2026-01-20 17:37:59 +0000

I wrote the blog engine this blog is hosted on in 2009, that is 23 years ago as I write this.

It was running a very old version of Ruby (1.8 as I recall) running on a very old version of Ubuntu server, and was ported to Rails3 from merb. It ran all that time, but finally started to show its age (as we all do!).

... Show more ...

Posted in Rails  |  Tags rails,upgrade  |  no comments

How to setup SyntaxHighlighter in Rails 3.1.1

Posted by Jim Morris on 2011-11-12 01:36:29 +0000

Or how to get Rails 3.1.1 assets in vendor/assets to work in production.

... Show more ...

Posted in Rails  |  Tags rails,syntaxhighlighter,assets  |  2 comments

Turn off forgery protection when using caching

Posted by Jim Morris on 2010-12-18 01:04:06 +0000

This one does not seem to be documented, and I just got bit.

After porting my blog engine to Rails 3, I noticed that after a while comments were being rejected with an ActionController::InvalidAuthenticityToken error.

... Show more ...

Posted in Rails  |  Tags rails,authenticity  |  4 comments

Upgrading a Rails 2.2.2 app to Rails 3

Posted by Jim Morris on 2010-12-17 15:27:17 +0000

After porting my blog engine from Merb to Rails3 code here I thought I'd upgrade my Snow Dogs R Us Site (aka dogz.us) to Rails 3.

It was written in Rails 2.2.2 so I figured it would not be too hard, well it was easier to port my Merb App than it was my Rails app!

... Show more ...

Posted in Rails  |  Tags upgrade,rails3  |  3 comments

A Simple Challenge Response authentication scheme for Rails3

Posted by Jim Morris on 2010-11-29 23:06:41 +0000

UPDATE the following is for pre rails 3.1, there is an addendum at the end for rails 3.1+

I have ported my blog engine (that hosts this site), from Merb to Rails 3. You would expect it to be fairly simple as Rails 3 is meant to be the next version of Merb.

... Show more ...

Posted in Rails  |  Tags authentication,javascript  |  no comments

Fixtures VS Factories, or how I do fixtures

Posted by Jim Morris on 2009-02-06 15:04:54 +0000

There is a raging debate in many forums about how to do fixture-like things. Basically how do you populate a database with test data so you can run your Specs/Tests/Features.

There are several libraries out there to do this like FactoryGirl, FixtureReplacement, Machinist, Fixjour etc etc. If you use Rails and ActiveRecord pick the one you like and be happy ;)

... Show more ...

Posted in Rails,Merb,Sequel  |  Tags merb,sequel,fixtures  |  1 comments

XPath matchers for rspec

Posted by Jim Morris on 2008-01-02 13:32:50 +0000

I've been working on a project that is mostly Java for the last many months, so haven't had much Ruby or Rails stuff to share.

However one thing I found when working on my tests in Java was an xpath matcher for JUnit 4.0 using the Hamcrest libraries.

... Show more ...

Posted in Rails,RSpec  |  Tags rspec,xpath,matcher  |  5 comments

Bit Vector Preferences

Posted by Jim Morris on 2007-08-07 23:53:09 +0000

In my latest web project I potentially have a lot of boolean preferences, which I use for enabling or disabling various email notifications to users.

Rather than having to add a migration everytime I want to add a new preference, I thought I would use the composed_of feature in my model and compose the boolean preferences from a bitvector. That way I can simply modify my model to add new preferences rather than add new columns to the database.

... Show more ...

Posted in Rails  |  Tags rails,preferences,composed_of,bitvector  |  2 comments

Paginating acts_as_taggable with will_paginate

Posted by Jim Morris on 2007-07-30 15:04:50 +0000

A question I see asked a lot is how do I paginate acts_as_taggable (on steroids)?

I haven't seen any answers I liked, so I created my own, which I'm sure a few people won't like either ;) But it works for me (tm).

... Show more ...

Posted in Rails  |  Tags acts_as_taggable,will_paginate  |  20 comments

RSpec testing all actions of a controller

Posted by Jim Morris on 2007-07-28 14:23:07 +0000

A pattern I find very helpful is to find all the actions in a controller and apply a test to all those actions.

For instance this is useful for automatically testing all actions are protected from unauthorized access when using a login system.

... Show more ...

Posted in Rails,RSpec  |  Tags rails,rspec,controllers  |  14 comments