I make it a point at any interview to go over this stuff when we get to the "Do you have any questions about us" portion of the interview. So far everyone has been very cool about taking care of such things in advance. Better to do it then instead of when things start getting bumpy and they start looking for stuff to hang on to.
One of the things that I started doing a long time ago was keeping an online diary of my ideas. When I come into a company, I list that diary as part of my previous work, so that I have a record that it's something outside of their company. I also make it a point to save emails with other developers that I've worked with, just in case. One thing nice about doing open-sourced developement is that there is an open record of what you've been doing.
So far I haven't had any ideas that a company has considered worth trying to claim as their own, but when I do, by golly, I'll be ready.
()-()
\"/
`