railsware / js-routes

Brings Rails named routes to javascript
http://railsware.github.io/js-routes/
MIT License
1.6k stars 146 forks source link

Bug: Prefix is ignored if a namespace is used #314

Closed jamesst20 closed 1 month ago

jamesst20 commented 1 month ago

Description

Rails

MyEngine::Engine.routes.draw do
  resources :fields

 # same with namespace :settings do ... end
  scope :settings, as: :settings, module: "settings" do
    resources :locales
  end
end

Javascript

import  * as Routes from "..."

Routes.configure({ prefix: "/prefix" });

Routes.fields_path()
// -> /prefix/fields

Routes.settings_locales_path()
// -> /locales
jamesst20 commented 1 month ago

Nevermind this issue! This is my fault my URLs were generated inside a

<script context="module">
   ...

basically before the prefix is applied