Reputation: 3972
In my Rails app, I have some views (layouts, partials) that I want to put in vendor/views
and vendor/views/layouts
instead of app/views
. But, it's implied by the guides (and the base project structure) that only assets
and plugins
are put in vendor
. Still, can I do this?
Upvotes: 2
Views: 170
Reputation: 6111
I once did manipulate the view_path, where Rails is looking for the views. I did it because I needed to have two versions of the views. So the way you could do it is manipulating
ActionController::Base.view_paths = ["app/views", "app/views/my_app", "app/views/your_app"] or ActionController::Base.prepend_view_path "app/views/my_app"
But as mentioned in this Blog Post, you should not because it is really expensive (the code is taken from this post). If you read further in the post, there is a solution provided. Maybe this helps for a start point.
Upvotes: 5