0

I have a classic rails app with haml and api part (exemple.com/api/v1/). I'm working on an ember app with ember-cli-rails that I want to be accessible at /front for the moment.

The problem is when I'm reloading it fails. The app go back to haml page or fail to route me correctly.

I checked this issue and try to implement it without success.

My routes.rb have nearly 400 lines. But for the moment the only thing who works is to add on the top of the file

  namespace :front do
    get '/', to: 'front#index'
  end

When I'm going on exemple.com/front is ok. If I click on user list I jump to a page at exemple.com/stores/5282/users when I click on a specific user exemple.com/stores/5282/users/345. When I reload

No route matches [GET] "/stores/5282/users"

To avoid failing I added this:

  match 'stores/*path', to: redirect('/front'), via: :all

But it just go back to the index page on my ember app. I've try also

  get 'stores/:all', to: "front#index"

But again no route matches.

EDIT : I've found an answer

  get 'stores/*other', to: "front/front#index"
Community
  • 1
  • 1
Mio
  • 1,412
  • 2
  • 19
  • 41

1 Answers1

1

The answer is :

 namespace :front do
    get '/', to: 'front#index'
 end

 get 'stores/*other', to: 'front/front#index'

Now when I go to exemple.com/stores/5282/users and I refresh it goes on the correct ember page. No route errror, no rediriction to /front.

Mio
  • 1,412
  • 2
  • 19
  • 41