Chillibear
A place for notes about stuff

Rails

FreeBSD 7 and Rails: undefined method `camelize’ for “app”:String

Okay, thought it was about time I had Rails installed on one of my FreeBSD boxes. So off to ports I trundle, two seconds later and I have Rails installed. Right time for a quick test app: []$ ruby -v ruby 1.8.7 (2009-04-08 patchlevel 160) [amd64-freebsd7] []$ rails -v Rails 2.3.4 []$ gem -v 1.3.5 [...]

Rails test database migrations

One problem it took me ages to spot was that my test database wasn’t up to date with my migrations and therefore my tests kept failing for no obvious reason! So remember to: rake db:test:prepare To ensure the test database is up to date with migrations, etc.

Boolean conditions in Rails find statements

I was having trouble getting a condition set on a standard find query. I had a table with a boolean column and was expecting to do something like this a = model.find(:all, :conditions => ‘checked = true’) But that (and variations on it) didn’t work, a bit of searching turned up a suitable solution here: [...]