FYI - patch for badly behaving filter code

Found a bug in the ActiveController filter code - when a filter called by call_filters itself adds another filter to the filter_chain - the 'update_filter_chain' method has a bug where it mutates the filter_chain as a side effect of calling Array.insert such that it is no longer a flattened list of filters - now it has an array as a member of the array.

This bug causes an array containing the new filter to be inserted into the filter_chain instead of just the filter itself - and since the filter_chain is no longer flattened, as soon as call_filters gets to the array it chokes on it, throwing the error in the trac issue I entered (with patch attached as well).

http://dev.rubyonrails.org/ticket/8383

I made what seemed like a reasonable patch, and tested it, though it took me long enough to figure this out that I stopped once I had it working correctly - sorry I didn't delve into creating a unit test yet, I'll work on it.

Anyway, in the meantime - this is a pretty nasty bug, and came up in normal use of ActiveScaffold - I have a feeling others will hit it soon as well, I hope someone shows it a little love and gets it committed.

Thanks,

Andrew Kuklewicz http://beginsinwonder.com