Rails 3: @template variable inside controllers is nil

跟風遠走 提交于 2019-11-26 21:37:18

问题


i've started using rails 3 beta3 and I have see that the @template variable inside controllers is nil. How I can call helpers methods inside a controller? Thx


回答1:


Use the view_context method instead of @template.

This is because in Rails 3 the new AbstractController was introduced.

You can read more here:

http://apidock.com/rails/AbstractController/Rendering/view_context



来源:https://stackoverflow.com/questions/3300582/rails-3-template-variable-inside-controllers-is-nil

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!