将此静态页面控制器代码更新为较新的rails版本

时间:2010-02-19 02:18:56

标签: ruby-on-rails controller

我一直在尝试使用这里的代码:

http://snafu.diarrhea.ch/blog/article/4-serving-static-content-with-rails

但我收到的错误如下:

 undefined method `template_exists?' for #<StaticController:0xb74cbe4c>

如何将此方法更新为Rails 2.5?可能还有其他被弃用的东西。

1 个答案:

答案 0 :(得分:1)

自Rails 2.2.1起,方法调用 template_exists?已弃用(请参阅:Rails APIdock

原作者在下面的文章article中进行了一些挖掘,揭示了解决方案。基本上需要将方法添加到从ApplicationController派生的StaticController中,从而给出方法。