Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Change in ActionController's filter API (cross-posted to Oceania list)

View parsed - Show only message text

MIME-Version: 1.0
Message-ID: <b76ae59f-571a-4d83-977b-da712b2b8957@i29g2000prf.googlegroups.com>
Date: Sun, 10 Feb 2008 18:01:51 -0800 (PST)
Received: by 10.100.207.5 with SMTP id e5mr89978ang.17.1202695311590; Sun, 10 
	Feb 2008 18:01:51 -0800 (PST)
X-IP: 58.108.49.199
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-us) 
	AppleWebKit/523.10.6 (KHTML, like Gecko) Version/3.0.4 Safari/523.10.6,gzip(gfe),gzip(gfe)
Subject: Change in ActionController's filter API (cross-posted to Oceania 
	list)
From: Ryan Allen <r...@yeahnah.org>
To: Melbourne Ruby User Group <melbourne-ruby@googlegroups.com>
Content-Type: text/plain; charset=windows-1256
Content-Transfer-Encoding: 7bit

People,

I'm not sure if this is very widely known, but 4 months DHH changed
the API for ActionController's filters [1]. Since for ever you could
halt the filter chain by returning false. This was (and still is)
advice given in the official AWDWR book by the PragProgs [2].

It is imperative that if you're using this method of filter chain
halting (and you've upgraded to Rails 2.0) that you update your code-
base ASAP, i.e.:

  before_filter :stop_nasty_buggers

  def stop_nasty_buggers
    false
  end

now becomes:

  before_filter :stop_nasty_buggers

  def stop_nasty_buggers
    halt(404)
  end

Returning false don't to jack no more. Note that redirecting and
rendering in a filter method still halts execution. The current
documentation point this out (halt on redirect or render) but doesn't
mention the deprecation of returning false, which makes this somewhat
ambiguous in my opinion.

There's no mention of this deprecation on the Rails website [3], no
mention of this API change in the official 'we iz got Rails 2.0 teh
r0x0r' post [4].

Was this announced anywhere (besides the ActionPack CHANGELOG) or do I
need my head checked for memory impairment?

Ryan.

P.S. if you were good boys and girls and had tests for your filters
(i.e. not like me), you'd have caught this in your builds.

[1] http://dev.rubyonrails.org/changeset/7984
[2] http://pragprog.com/titles/rails2
[3] http://www.rubyonrails.org/deprecation

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google