You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using devise and omniauth gems (versions 4.9.4 and 2.1.2) in brand new rails app, I have 3 providers - google, twitter and facebook. The generated paths have incorrect methods get|post
config/routes.rb
defaultsexport: truedo# All routes defined inside this block will be exported.devise_for:users,controllers: {omniauth_callbacks: "users/omniauth_callbacks"}end
So my question is, is there anything we can do with it? Maybe the gem could use the as option that was added to the route and add method as suffix?
So the result would be something like google_oauth2_omniauth_authorize_get, google_oauth2_omniauth_authorize_post, or in case of test that would be testGet, testPost, testPatch etc...
Or maybe there is some option for different exporting for such routes that I missed?
In any case, thanks for the useful gem!
The text was updated successfully, but these errors were encountered:
# config/initializers/js_from_routes.rbifRails.env.development?# Internal: Override to prefer POST requests for dual paths.JsFromRoutes::Route.prependModule.new{defverb@route.verb.split("|").last.downcaseend}end
I'd like to extend support to routes that are not following the default routing patterns, but I haven't decided how that should be exposed to the frontend.
Grouping routes by controller felt like a natural way to use them, while also allowing tree-shaking.
I'm not sure what would be a good convention when a route doesn't "belong" to any resource. The main problem with non-REST routes is that I haven't needed that in any of the apps I've worked on, and it's difficult to think about it without a concrete use case.
bundle update js_from_routes
.Description 📖
I am using
devise
andomniauth
gems (versions 4.9.4 and 2.1.2) in brand new rails app, I have 3 providers - google, twitter and facebook. The generated paths have incorrect methodsget|post
config/routes.rb
Output of related
rails routes
Generated result
Probably its not related to devise but to the way routes are defined and how this gem handles it.
Related code from devise gem https://github.com/heartcombo/devise/blob/72884642f5700439cc96ac560ee19a44af5a2d45/lib/devise/rails/routes.rb#L446C9-L457C1
Basically if the different HTTP methods are mapped to the same controller action this issue will appear.
For example,
results in
So my question is, is there anything we can do with it? Maybe the gem could use the
as
option that was added to the route and add method as suffix?So the result would be something like
google_oauth2_omniauth_authorize_get
,google_oauth2_omniauth_authorize_post
, or in case oftest
that would betestGet
,testPost
,testPatch
etc...Or maybe there is some option for different exporting for such routes that I missed?
In any case, thanks for the useful gem!
The text was updated successfully, but these errors were encountered: