How can I set a static page (high_voltage) as root in Rails?

349 Views Asked by At

I used gem high_voltage to get static pages and it worked, but now I want to define one of them as root. What should I write in Routes.rb since I don't have a controller?

1

There are 1 best solutions below

1
Max Vinicius On BEST ANSWER

You can configure the root route to a High Voltage page like this:

# config/initializers/high_voltage.rb

HighVoltage.configure do |config|
  config.home_page = 'home'
end

Which will render the page from app/views/pages/home.html.erb when the '/' route of the site is accessed.

Note: High Voltage also creates a search engine friendly 301 redirect. Any attempt to access the path '/home' will be redirected to '/'.

Source: https://github.com/thoughtbot/high_voltage#specifying-a-root-path