Capturing screenshots on test failures

Hi
I’m using rspec to run my functional tests and I’d like to add a
hook to be executed every time a spec fails so that I can capture a
screenshot. What’s the best way to do this?
Also I’d like to name my screenshot uniquely by the name of the spec.
Does it make sense to use self.example.full_description?

thanks
Vishnu