Using different controllers for different directories with the High Voltage in Ruby on Rails

99 Views Asked by At

I'm trying to create some static pages in Rails and using the High Voltage gem for this purpose.

What I want is to have custom URLs for different subsets of my pages. I also want to override the default High Voltage controller in order to use different layouts for different pages.

So that, say, http://example.com/about will render the about.html.erb view in the view/pages folder. But http://example.com/promo/1 will render the 1.html.erb page in the view/pages/promo folder.

I've disabled the default routes in high_voltage.rb:

HighVoltage.configure do |config|
  config.routes = false
end

And then added a router that redirects all URLs with the promo path to the promo controller:

get "/promo/*id" => 'promo#show', as: :promo, format: false

But now my PromoController looks for view files in the /views/pages folder. How do I tell it to render views from /views/pages/promo folder instead?

0

There are 0 best solutions below