我似乎无法让thoughtbot 的高压 gem用于不以 . 开头的 URL /pages
。对于类似 的 URL www.example.com/pages/company/about
,它可以完美运行。当我添加这条路线时:
match '/company/about' => 'high_voltage/pages#show', :id => 'about'
我收到内部服务器错误:
Started GET "/company/about" for 127.0.0.1 at 2012-10-09 18:03:45 -0700
Processing by HighVoltage::PagesController#show as HTML
Parameters: {"id"=>"about"}
Completed 500 Internal Server Error in 2ms
ActionController::RoutingError (No such page: about):
high_voltage (1.2.0) app/controllers/high_voltage/pages_controller.rb:9:in `block in <class:PagesController>'
activesupport (3.2.8) lib/active_support/rescuable.rb:80:in `call'
activesupport (3.2.8) lib/active_support/rescuable.rb:80:in `rescue_with_handler'
actionpack (3.2.8) lib/action_controller/metal/rescue.rb:15:in `rescue_with_handler'
但是,如果我只是把about.html.erb
页面放在里面app/views/pages/about.html.erb
,那么这条路线的一切都会按预期工作:
match '/:id' => 'high_voltage/pages#show'
或者这条路线也有效:
match '/about' => 'high_voltage/pages#show', :id => 'about'