I have a PasswordsController to handle password recovery and I want to route it as a singular resource.
The code from the router:
resource :password
I want to use the generated routes as follows:
/password/new # User enters email
/password/create # Send email with link to password edit form with token
/password/edit # User edits password
/password/update # Password is changed
But for some reason rails only generates the following routes:
password GET /password(.:format) passwords#show
PATCH /password(.:format) passwords#update
PUT /password(.:format) passwords#update
DELETE /password(.:format) passwords#destroy
POST /password(.:format) passwords#create
According to the documentation there should also be an edit path and a new path.
Why are they missing?
(This is rails 5.2.1.1)
Edit: As mentioned in the comments, problem must lie somewhere in my app's configuration as this is not reproducible with a clean rails app.
It looks like you have an api_only app. In that case Rails omit edit and new path. see: https://github.com/rails/rails/blob/fc5dd0b85189811062c85520fd70de8389b55aeb/actionpack/lib/action_dispatch/routing/mapper.rb#L1230
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With