regex - Ruby on Rails exclude group elements in route constraints -
i wondering, how define constraints regex route, match if excludes every single element of group.
for instance, so:
get "list/:action", :constraints => {:action => [none of following: (new, edit, delete, update)}
i know if want match of elements of list, have defined so:
get "list/:action", :constraints => {:action => /(new|edit|delete|update)/},
don't know, how make work described above.
i have tried using ^
, !
signs before group, no luck far - there has notation one, think.
how exclude these elements ?
try following. it'll exclude actions route.
class excludeactions def matches? ["new", "edit", "delete", "update"].exclude? params[:action] end end "list/:id", :constraints => excludeactions.new
this exclude new
, edit
, delete
, update
actions routes list
Comments
Post a Comment