jacr1614
jacr1614

Reputation: 1310

To use a group of views with different templates for the same actions in controller in rails 4

I have two layouts for my application, and I need to use a group of views for one of those templates (for same controller actions)

I don’t want to touch each action on the controllers specifying the view to use with render.

My views looks like:

* /Views/controller_abc/new.erb
* /Views/alternative_template/controller_abc/new.erb

Upvotes: 1

Views: 20

Answers (1)

Arnold Roa
Arnold Roa

Reputation: 7708

You can use prepend_view_path, in your ApplicationController

before_filter :set_view_path

def set_view_path
    prepend_view_path "#{Rails.root}/app/views/alternative_template"
end

Upvotes: 1

Related Questions