Missing template blogs/index on Ruby on Rails project

前端 未结 6 1336
野的像风
野的像风 2020-12-29 09:11

For one of my projects I\'m getting this exception every now and then:

ActionView::MissingTemplate: Missing template blogs/index with {:handlers=>[:rx

6条回答
  •  自闭症患者
    2020-12-29 10:05

    I would be tempted to rescue the MissingTemplate in your application controller and log the Referrer header to see what's triggering this request. You never know, it might be some obscure part of your own app!

    If on the other hand you're confident this is being caused by a robot, have you considered adding the offending URL to your robots.txt file? For example:

    User-Agent: YandexImages
    Disallow: /your/failed/path
    

    Replacing 'your/failed/path' with the path that the robot is stumbling over. If the robot is struggling all over the place, you could just disallow access to the whole site for that particular robot:

    User-Agent: YandexImages
    Disallow: /
    

    I think this is a cleaner and lighter approach than implementing a handler specifically to suppress errors from a seemingly badly behaved bot.

提交回复
热议问题