Replies: 2 comments 6 replies
-
Yeah, integrating with Rails routes is something I've been considering, but didn't yet find a robust way to handle that. I would definitely like to explore this more deeply, and would appreciate any assistance.
Note that you can use rodauth = Rodauth::Rails.rodauth
rodauth.login_path # *_path methods
rodauth.logout_url # *_url_methods
rodauth.create_account_path(type: "admin") # GET query parameters
I wish Rails had some API for registering custom routes. I was looking into somehow extending the
You can currently do access them via login_redirect { Rails.application.routes.url_helpers.activity_path } I thought about
This would also probably automatically display them in
Note that it's not possible that RodauthController handles those routes, because the endpoint functionality is implemented on the Roda routing level. |
Beta Was this translation helpful? Give feedback.
-
Two and a half years later, I finally realized the importance of having native URL helpers for Rodauth routes you were advocating for. In my case, I was porting rubygems.org authentication to Rodauth just as an experiment, and the locale switcher that used I implemented this in #245. If you have some time, would you mind giving it a try? It should just work™️ with locale prefixes as well: Rails.application.routes.draw do
scope "(:locale)" do
rodauth
end
end create_account_path(locale: "hr") #=> "/hr/create-account" |
Beta Was this translation helpful? Give feedback.
-
I am approaching completion of my migration from Devise to Rodauth and the fact that Rodauth routes are not proper Rails routes is a bit annoying:
_url
helpersGET
parameter to an URL)rails routes
As a side node, on the other way around Rails route helpers are not accessible from your Rodauth App, so you can not do things like this out of the box:
I think it should be possible to have a method to add these routes to
routes.rb
, reading them from Rodauth's routes and instanciating them as standard rails routes so the helpers are here. They can be routed to theRodauthController
and not implemended here as the middleware will intercept them.What do you think?
Beta Was this translation helpful? Give feedback.
All reactions