Right now, filters run for as many times as you call, eg., before_filter.

If you do something like:

  5.times { before_filter :foo }

it might be expect, but I think the more common case of:

  @ ApplicationController
  before_filter :foo

  @ SubController
  before_filter :foo, :except => :bar

yields the unexpected result where :foo will run twice. (Luckly, for sub/bar it doesn't run at all, which is what I would expect)

I understand that in this particular case using skip_before_filter would fix it, but...

Do you really think it's a good idea to run filters more than once?

How about maybe adding a uniq option to pre/append_filter_to_chain, that would ensure a filter is never added twice (but related conditions may be changed)?

It would seem to me most filters that end up running twice or thrice do so harmlessly, but needlessly. At most, hindering performance.

_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to