Saturday, 03 Sep 2016

Configuring High Voltage gem to use custom extension path

By default the High Voltage gem places pages in the /page/:id route. This article shows how to change this to /:id.html

Disable routes in initialiser
# config/initializers/high_voltage.rb
HighVoltage.configure do |config|
  config.routes = false
end
Add custom route in config/routes.rb:
Rails.application.routes.draw do
  get "*id.html" => 'high_voltage/pages#show', as: :page, format: false
  root to: 'high_voltage/pages#show', id: 'home'
end
comments powered by Disqus