ElMassimo / js_from_routes

🛣️ Generate path helpers and API methods from your Rails routes
https://js-from-routes.netlify.app/
MIT License
100 stars 7 forks source link

Not generating confirmations_controller routes for devise gem. #33

Closed siba2893 closed 2 years ago

siba2893 commented 2 years ago

Description 📖

Hey I was trying for the Rails + Vite + Vue 3 + Inertia.js combo, while comparing the Original Demo App vs your version of the Demo App, I love the gem that you built called js_from_routes its quite cool.

But I encounter a problem, for some reason the gem doesn't want to generate the users/confirmations_controller routes for Devise, it does generate the sessions, registrations, passwords but not the confirmations.

You can see at the screenshot how all the other controllers are there as Api routes.

Reproduction/Logs 🐞📜

Add the confirmations_controller in your devise example app and try to see if it generates the routes.

Screenshots 📷

Captura de Pantalla 2022-08-03 a la(s) 7 37 58 p  m
ElMassimo commented 2 years ago

Hi Daniel, please share a repo with a minimal reproduction and I'll take a look.

I tested in an app, and it generated confirmations as well:

// JsFromRoutes CacheKey d373e19a0694ae472b5b76beaad73f93
//
// DO NOT MODIFY: This file was automatically generated by JsFromRoutes.
import { definePathHelper } from '~/services/api'

export default {
  new: definePathHelper('get', '/users/confirmation/new'),
  show: definePathHelper('get', '/users/confirmation'),
  create: definePathHelper('post', '/users/confirmation'),
}
siba2893 commented 2 years ago

Yes of course here is the example project I was making https://github.com/siba2893/inertia_example_rails_7

ElMassimo commented 2 years ago

If you run bin/rails routes | grep confirmations in the app, you will notice there are no routes for confirmations, which is the reason why js_from_routes is not generating helpers.

The reason Devise is not adding those routes is related to the Devise configuration, you must add :confirmable to the User model.

siba2893 commented 2 years ago

OMG thank you so much for finding the out.