Aside from the fact that I am creating a web app, using lots of open-source technology (which obviously they can't own), what does that statement mean really?
The contract should have a clause about using open-source materials or third-party libraries. Usually something to the effect that you must notify the client about any open-source materials you use. Make sure you don't use anything with a viral open-source license.
If the contract has no provisions for open-source material/third-party libraries, the client is probably too inexperienced to be worth working for, but you should still take the time to explain that you'll never be able to complete the task if you have to reinvent the wheel and the hammer and sliced bread and electricity. (I once chatted with a potential client who wanted to make an Android app without using any third-party technology whatsoever. I had to explain to them that it was not practical to make an app without using the Android SDK or some third-party app development framework.)
If I write a nice, elegant, custom method (say a before_filter) that solves a particular problem in this project (one that I have never encountered before, but I would like to use in the future), by agreeing to this clause does it mean that I can't use that custom method or any other original works I create for that project?
Of course. If this bothers you, you are going to have a very difficult time freelancing. There are some helper functions and utility classes I always use that I've rewritten from scratch a dozen times for different clients.
I'm not a lawyer, but I think the general rule of thumb is that you can copyright a specific piece of written code, but you can't copyright an algorithm. So let's say that you come up with a new sorting algorithm while you are working on a project, and the specific sorting algorithm itself isn't a crucial intrinsic part of the application (i.e., you could reasonably replace it with a different sorting algorithm). Then you are probably clear to recreate that algorithm from memory on a future project. However, if you were hired specifically to write that algorithm, or the algorithm is highly specialized and could not reasonably be replaced with another algorithm, you probably shouldn't try to reproduce it later. Also, don't memorize the code for the algorithm so well that you can rewrite it line-by-line entirely from memory; at that point, you are copying, rather than recreating.
This seems like a trap all around. How do I avoid getting myself handcuffed and prevented from continually improving my craft by using work I have done in other projects and making it better?
It's not a trap, it's fairly standard. Why would people want to pay you to write code which you get to keep and reuse later without their permission? You can probably find some clients who are okay with it, but don't plan on it.