Strange routing error in Rails 3.0.1 -
this irritates me right now, , i've been @ more hour. maybe 1 of has idea.
i've defined following routes in routes.rb:
resources :ads member post :preview_revision :revise end collection :search post :preview end end
when run rake routes
, preview_revision route shown correctly:
preview_revision_ad post /ads/:id/preview_revision(.:format) {:action=>"preview_revision", :controller=>"ads"}
however, when make post request /ads/145/preview_revision, following error:
started post "/ads/145/preview_revision" 127.0.0.1 @ mon nov 15 17:45:51 +0100 2010 actioncontroller::routingerror (no route matches "/ads/145/preview_revision"): rendered /library/ruby/gems/1.8/gems/actionpack-3.0.1/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.2ms)
- the id (145) exists, yes.
- the action , controller (action: preview_revision, controller: ads) exist well.
- all other routes work fine
- i've tried restarting server several times
- i double-checked it's post request, id correct, don't know anymore.
- rails version 3.0.1
--- update ---
i tried changing method post put, , works. apparently post routes on member level not working, or not allowed.
still, want know why. know post creating member, post request on member makes no sense, didn't find mentioned anywhere in rails guides, , why rake routes
display route, if doesn't work? bug?
--- update 2 ---
the rails routing guide (edge version) says:
2.9.1 adding member routes
to add member route, add member block resource block:
resources :photos member 'preview' end end
this recognize /photos/1/preview get, , route preview action of photoscontroller. create preview_photo_url , preview_photo_path helpers.
within block of member routes, each route name specifies http verb recognize. can use get, put, post, or delete here. if don’t have multiple member routes, can pass :on route, eliminating block [...]
so post on member possible or not possible? missing something? clear, don't wanna use anymore, still, bugs me not knowing why doesn't work.
the best thing do, if find bug in actively maintained open-source software, is:
- to submit bug report project's bug tracker isolating problem as possible , detail possible, and, optionally,
- to include patch fixes bug if can.
the bug tracker rails @ rails.lighthouseapp.com.
---edit---
the bug tracker rails @ github.com/rails/rails/issues.
Comments
Post a Comment