RailsCasts Pro episodes are now free!

Learn more or hide this

Steve Grossi's Profile

GitHub User: stevegrossi

Site: http://stevegrossi.com

Comments by Steve Grossi

Avatar

I found a solution on StackOverflow. By appending constraints: { id: /.*/ } to the get route, so it reads:

ruby
get ':id', to: 'pages#show', as: :page, constraints: { id: /.*/ }

it now recognizes routes to pages with slashes in their permalinks like "about/jobs". I guess Rails has its own constraints (like no slashes) on id's that this overrides.

Avatar

Any thoughts on nesting pages like this? Specifically, say I want an About page at "/about" and a Jobs page at "/about/jobs". I've tried setting the permalink for the jobs page to be "about/jobs", but Rails doesn't recognize this route.