This project is archived and is in readonly mode.
[PATCH] in routes.rb :conditions => {:method => :any} gives error
-
qoobaa
Can't you just use:
ActionController::Routing::Routes.draw do |map| map.good 'good', :controller => 'good', :conditions => {:method => :get} map.bad 'bad', :controller => 'bad' map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' endDoes it make any sense to add a condition that matches every case?
-
trevor
the documentation states "Takes a hash of #{action} => #{method}, where method is :get/:post/:put/:delete, an array of any of the previous, or :any if the method does not matter."
i'm expecting consistent behavior, one way or the other.
% grep -R ':any' r* resources.rb: # an array of any of the previous, or <tt>:any</tt> if the method does not matter. resources.rb: # map.resources :messages, :new => { :new => :any, :preview => :post } resources.rb: options[:conditions][:method] = method unless method == :any routing/route.rb: "%-6s %-40s %s" % [(conditions[:method] || :any).to_s.upcase, segs, requirements.inspect] routing.rb: # <tt>:get</tt>, <tt>:put</tt>, <tt>:delete</tt> and <tt>:any</tt>. The default value is <tt>:any</tt>, routing.rb: # <tt>:any</tt> means that any method can access the route. -
Frankie Roberto
This seems does seem to be broken.
Works for resources (:collection => {:test => :any}) but not for named paths.
-
anupom syam
- Tag set to patch, tested
i think it's broken. i am adding a patch along with this ticket (with tests).
-
anupom syam
- Title changed from in routes.rb :conditions => {:method => :any} gives error to [PATCH] in routes.rb :conditions => {:method => :any} gives error
-
CancelProfileIsBroken
- Tag changed from patch, tested to bugmash, patch, tested
-
qmx
+1
Apply cleanly to current stable.
-
pjammer
+1 I verified this patched worked for me in a mini app, as well as the tests passed.
-
Derander
+1 verified. Applies cleanly to current stable & master.
Tests pass for stable, and two tests fail on master. I do not believe they're related -- they're dealing w/ the textilize method.
-
José Valim
- State changed from new to wontfix
- Tag changed from bugmash, patch, tested to patch, tested
As Jakub pointed, you can already do that. We would just add more code to maintain.
-
freerobby
If you need a quick substitute, passing in nil in place of :any works as follows:
:conditions => {:method => nil}
