Posted by Chris Anderton on December 19th, 2007 @ 12:45 – 1 comment
Updated on December 19th, 2007 @ 12:49
Tagged with akismet, defensio, mephisto, plugin, rails, ruby, spam filter, uk rails
We wanted to give Defensio a whirl as we'd read good things about it - up until now we'd used the Akismet feature that comes available with Mephisto as default.
As usual, a quick google took place but no plugins were showing in the usual places (the Mephisto Wiki and Newsgroup).
So, rather than wait for someone else to do it then I went ahead and made it happen!
Read more of this entry
Posted by Rob Anderton on December 16th, 2007 @ 19:34 – 3 comments
Updated on June 10th, 2008 @ 12:15
Tagged with bug, migration, model, observer, rails, rails development, ruby, validation
If you have a model that uses validates_acceptance_of, you have an observer for that model and you try to run the migration responsible for creating the underlying table then the db:migrate task will fail. The actual error you receive will depend upon your database engine – on MySQL it looks something like this:
Mysql::Error: Table 'database_name.table_name' doesn't exist: SHOW FIELDS FROM `table_name`
The culprit is changeset 8208 which allows the attribute used by validates_acceptance_of to actually exist in the database rather than being virtual. When running the migration to create the underlying table, environment.rb causes the model observer to be loaded which in turn loads the model itself. When the model is loaded validates_acceptance_of tries to determine the column names of the (as yet non-existent) table and, yes you guessed it, blows up!
The good news is that changeset 8377 was submitted 4 days ago to fix this problem. To take advantage of it you’ll either have to freeze Rails to the latest revision or you can simply apply the patch if you’re using something like Piston to manage vendor/rails.
18th December Update: Rails 2.0.2 has now been released and includes the fix for this problem.
Discuss this entry
Posted by Rob Anderton on December 12th, 2007 @ 17:23 – 1 comment
Updated on June 10th, 2008 @ 12:15
Tagged with controller, filter, rails, rails development, ruby
Here’s one that could have you scratching your head in puzzlement for a little while. In Rails 1.2.x you could do something like this in your controller:
class PostsController < ActionController::Base
before_filter :do_filter
# Controller code
protected
def do_filter
# Filter logic goes here
# Halt the filter chain
false
end
end
If the filter returned false then processing of the request would stop and you’d see a blank page in your browser.
Not so in Rails 2.0: thanks to changeset 7984 the filter chain is only halted if you render or redirect within your filter. If you really want to get similar behaviour to Rails 1.2.x you could always do this:
def do_filter
# Filter logic goes here
# Halt the filter chain
head :bad_request
end
Although you will probably be more popular with your users if you display some kind of friendly error message!
Discuss this entry
Posted by Rob Anderton on December 10th, 2007 @ 16:08 – 18 comments
Updated on June 10th, 2008 @ 12:15
Tagged with autotest, growl, mac, rails, rails development, ruby, snarl, windows, zentest
Earlier this year I started using RSpec and loved it immediately. Testing is not the most exciting or glamorous part of software development but a behavioural driven approach really appealed to me, as did the much more readable RSpec syntax.
To get me started I bought the RSpec Basics screencast from PeepCode (which has since expanded into a 3 part series). It was a good introduction but, as is often the case in Rails-land, it left me with a case of Mac envy.
The screencast includes a section on using autotest (part of the ZenTest package) and Growl to get instant pop-up notifications when specifications pass or fail. But what about me on my trusty Dell laptop? Where are my shiny notifications?
The good news is that autotest also includes support for Snarl, a Windows alternative to Growl. Hurrah!
Read more of this entry
Posted by Rob Anderton on December 8th, 2007 @ 12:40 – 2 comments
Updated on June 10th, 2008 @ 12:16
Tagged with rails, rails development, ruby
So Rails 2.0 is finished although, thanks to a last minute fix, it’s version 2.0.1 and not 2.0.0 as you might expect.
Ryan Daigle has posted a big list of changes but even that doesn’t catch all of the features in this new version, there are just too many, so we can expect a slew of new books and screencasts soon. Ryan Bates (why are so many Ryans involved in Rails?) is ahead of the game with his excellent Rails 2.0 Railscasts.
I’ve just updated this site without any difficulties and the new project we’ve just started will be built with Rails 2.0 giving us a great opportunity to try out all the new features.
Now we can look forward to the smokin’ fast Ruby 1.9 that should be out soon and then eagerly await the release of Rails 3.0!
Discuss this entry
Posted by Chris Anderton on December 5th, 2007 @ 11:21 – 0 comments
Updated on December 19th, 2007 @ 11:06
Tagged with design, identity, logo, refresh, to-done
After a lot of work our new logo is complete. Thanks to all the efforts of Jon Pink we now have a shiny new logo that works just as well on the web as it does in print.
Read more of this entry
Posted by Rob Anderton on December 2nd, 2007 @ 17:46 – 12 comments
Updated on June 10th, 2008 @ 12:16
Tagged with compiler, imagescience, rails development, ruby, rubyinline, win32, windows
According to the website ImageScience is a clean and happy Ruby library that generates thumbnails – and kicks the living crap out of RMagick.
What it fails to mention is that by the time you’ve jumped through all the hoops necessary to get it running on Windows you’ll be qualified to start working as a professional acrobat.
Read more of this entry