1

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?

Edi Junior
  • 33
  • 8

1 Answers1

0

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

Max Vinicius
  • 660
  • 1
  • 4
  • 11
  • 1
    Thanks a lot! I'll remember to always read the docs completely. Also had to reinitialize the server to see the changes... – Edi Junior Jun 05 '19 at 15:48