Alternative to prepend/append_view_path in Rails 3?

◇◆丶佛笑我妖孽 提交于 2019-12-23 02:04:45

问题


I'm trying to add another directory to the paths that Rails looks in to find views, and I found a working solution in the methods ActionController::Base.prepend_view_path and ActionController::Base.append_view_path, but they are both marked as deprecated in Rails 3. Is there an alternative that I can use?

http://apidock.com/rails/ActionController/Base/prepend_view_path

http://apidock.com/rails/ActionController/Base/append_view_path


回答1:


The ActionController::Base.append/prepend_view_paths were deprecated, as they were extracted out into the AbstractController module. If you call those methods from your controller, the AbstractController methods would be called, not the deprecated ActionController one.

https://github.com/rails/rails/blob/master/actionpack/lib/abstract_controller/view_paths.rb#L25



来源:https://stackoverflow.com/questions/5479473/alternative-to-prepend-append-view-path-in-rails-3

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