I just updated my blog to Rails 4 from 3. I have a catch all route pattern:
get ':year/:month/:permalink' => 'posts#show'
So routes look like this:
/2012/02/blog_permalink
That works fine, but if I add a forward slash, I get:
No route matches [GET] "/2012/02/blog_permalink/"
I can't seem to figure this one out? I've tried adding a "/" to the end of the route and using :trailing_slash => true. But both of those didn't help.
From my perspective it's looks like best solution for this issue till it fixed on rails side are remove trailing slash using rewrite rule on server side. After this issue will be gone, you'll just remove unnecessary config line from server configuration.
在Application.rb
,设置以下行:
config.action_controller.default_url_options = { trailing_slash: true }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.