Solve #5348
Add ActiveRecord::RecordNotFound catching. Add tests.
Merge pull request #5491 from collimarco/solved5348

Solve #5348