We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new
When I define the routes like that
get '/users', to: 'users#index' get '/users/:id', to: 'users#show' get '/users/new', to: 'users#new'
and tries to parse this route: GET /users/new
GET /users/new
the parser returns:
Controller users Action new Params {}
but when I define it like: resources :users
resources :users
it returns:
The route GET /users/new parses to:
Controller users Action show Params {"id"=>"new"}
Maybe we need to modify recognize method in lib/route_recognizer to handle the reserved routes first?
recognize
lib/route_recognizer
def recognize(method, uri) # Handle reserved routes first return { 'controller' => 'users', 'action' => 'new' } if uri == '/users/new' return { 'controller' => 'users', 'action' => 'edit' } if uri == '/users/edit' # Then handle dynamic routes rack_request = RackRequest.new(method, uri) request = ActionDispatch::Request.new(rack_request.env) all_params = nil @routes.router.recognize(request) do |route, params| all_params = request.query_parameters.merge(params) end raise NoMatchingRouteError unless all_params all_params end
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When I define the routes like that
and tries to parse this route:
GET /users/new
the parser returns:
but when I define it like:
resources :users
it returns:
The route
GET /users/new
parses to:Maybe we need to modify
recognize
method inlib/route_recognizer
to handle the reserved routes first?The text was updated successfully, but these errors were encountered: