Comments
-
Greg Hurrell
Yep, local testing confirms that it's the dot in the article name. Yields a routing error.
-
Greg Hurrell
Summary changed:
- From: Commenting on wiki articles leads to 404
- To: Commenting on wiki articles with periods in the titles leads to 404
-
Greg Hurrell
Summary changed:
- From: Commenting on wiki articles with periods in the titles leads to 404
- To: Commenting on wiki articles with periods in the titles leads to 404 (RoutingError)
-
Greg Hurrell
Sigh, this may not be straightforward to fix. The routing defined in
config/routes.rb
looks correct to me at first glance:map.resources :articles, :as => :wiki, :requirements => { :id => /[^\/]+/, :protocol => 'https' }, :has_many => [ :comments ]
The
requirements
don't seem to "trickle down" to the nested part of the association. -
Greg Hurrell
Might try rewriting it as:
map.resources :articles, :as => :wiki, :requirements => { :id => /[^\/]+/, :protocol => 'https' } do |articles| articles.resources :comments end
Should be equivalent, but might not be affected by the bug...
-
Greg Hurrell
As expected, same problem affects blog posts with periods in permalink.
-
Greg Hurrell
Summary changed:
- From: Commenting on wiki articles with periods in the titles leads to 404 (RoutingError)
- To: Commenting on wiki articles with periods in the titles, blog posts with periods in permalink, leads to 404 (RoutingError)
-
Greg Hurrell
Unfortunately rewriting it doesn't work. Looks like a Rails routing bug to me. Will dig deeper.
-
Greg Hurrell
Created
,
edited
Ok, found the workaround. Pretty ugly, but works:
map.resources :articles, :as => :wiki, :requirements => { :id => /[^\/]+/, :protocol => 'https' } do |articles| articles.resources :comments, :requirements => { :article_id => /[^\/]+/, :protocol => 'https' } end
The fact that you have to do it this way is definitely a design wart, if not a bug, but at least we have a workaround.
-
Greg Hurrell
Ok, fixed it for blog posts as well.
-
Greg Hurrell
Ok, this is now deployed. Will mark as closed.
-
Greg Hurrell
Status changed:
- From: new
- To: closed
Add a comment
Comments are now closed for this issue.