Hi guys!
If you set “routes.rb” as:
map.resources :pocoyo
You have RESTful rails routes facilites. Ok, let’s focus on these two
maps:
“http://domain.com/pocoyo” [GET] is mapped to “pocoyo” controller
and “index” action.
“http://domain.com/pocoyo” [POST] is mapped to “pocoyo” controller
and “create” action.
if you adds “:path_prefix” as:
map.resources :pocoyo, :path_prefix=‘:country’
You have the same RESTful rails routes faicilites, but with non
correct behavior on POST calls:
“http://domain.com/pocoyo” [GET] is mapped to “pocoyo” controller
and “index” action.
“http://domain.com/pocoyo” [POST] is mapped to “pocoyo” controller
and “INDEX” action. (incorrectly to “index” instead to the correct
“create” action)
if you review your “rake routes” results, you can see that “http://
domain.com/pocoyo” called with POST verb is mapped to “create” action
and not for “index” action that is matching with “GET” verb.
If you debug the http call, you can see that a correct POST is
processing.
I came to conclusion that, using “path_prefix” on you routes rules,
produces no corrects maps for verb evaluation.
Only if provides url with “:country”, like “http://domain.com/
somecountry/pocoyo” [POST] can be correctly mapped to “create” action.
If rails route can map “http://domain.com/pocoyo” [GET]" with a
“path_prefix” to correct action, should be able to map correctly
“http://domain.com/pocoyo” [POST]" to their appropriate action, giving
the verb as the normal RESTful mapping way.
Some reasoning about ???
Thanks!