Handle actionview errors at runtime?

Hello,

How do we catch any errors which happen in the actionview during
runtime? I get

ActionView::Template::Error (undefined method

error in my logs during production.

How can I catch this error and show a meaningful message to user and log
a more detailed message in log file so that I can analyze it later?
Also, how can I customize the error pages 500 and 404 with the messages
giving details about the transaction/action and data that caused the
error/exception and also how can I log those details also?

I am using Ruby 1.8.7 and Rails 3.0.3.