简体   繁体   中英

Alternative to prepend/append_view_path in Rails 3?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM