You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment if you want to use a custom controller but otherwise use the HighVoltage internal mechanics, you have to turn off routes and unset the home_page due to the way the routes files is coded:
HighVoltage.parent_engine.routes.draw do
if HighVoltage.home_page
get "/#{HighVoltage.home_page}", to: redirect('/')
root to: 'high_voltage/pages#show', id: HighVoltage.home_page
end
if HighVoltage.routes
get HighVoltage.route_drawer.match_attributes
end
end
We could nest the home page routes under the if HighVoltage.routes logic, which is more what I would expect if I disabled the gem routes. I think that is a standalone improvement.
But I would also like to suggest that the home page routes and could be modified to support just using a custom routes drawer to enable full custom controller support. One way is to add a new config option controller_name or rack_endpoint with a default of "high_voltage/pages" which could be inserted in the routes i.e.
root to: "#{HighVoltage.controller_name}#show", id: HighVoltage.home_page
and a similar change in the route drawers.
Alternatively we could modify the current route drawers to use a different get options method signature
i.e. in routes drawer
HighVoltage.parent_engine.routes.draw do
if HighVoltage.home_page
get "/#{HighVoltage.home_page}", to: redirect('/')
root to: HighVoltage.route_drawer.match_attributes[:to], id: HighVoltage.home_page
end
if HighVoltage.routes
get(*HighVoltage.route_drawer.match_attributes)
end
end
This is neatly internally consistent, but has the problem of backward compatibility. Which could be overcome with a little ugly check on the return value type of match_attributes being an array or hash.
The text was updated successfully, but these errors were encountered:
At the moment if you want to use a custom controller but otherwise use the HighVoltage internal mechanics, you have to turn off
routes
and unset thehome_page
due to the way the routes files is coded:We could nest the home page routes under the
if HighVoltage.routes
logic, which is more what I would expect if I disabled the gem routes. I think that is a standalone improvement.But I would also like to suggest that the home page routes and could be modified to support just using a custom routes drawer to enable full custom controller support. One way is to add a new config option
controller_name
orrack_endpoint
with a default of"high_voltage/pages"
which could be inserted in the routes i.e.and a similar change in the route drawers.
Alternatively we could modify the current route drawers to use a different
get
options method signaturei.e. in routes drawer
paired with
This is neatly internally consistent, but has the problem of backward compatibility. Which could be overcome with a little ugly check on the return value type of
match_attributes
being an array or hash.The text was updated successfully, but these errors were encountered: