Ember-cli-rails No route match for ember's paths

260 Views Asked by At

In a Rails and Ember project, I decided to use EmberCLI Rails because I want to do integration tests with Capybara and all my favorite testing gems.

I installed it and it works when I go to the home page.

I added routes on ember like this :

  import Ember from 'ember'
  import config from './config/environment'

  Router = Ember.Router.extend(location: config.locationType)
  Router.map ->
    @resource 'users'

  export default Router

When I go on http://localhost:3000/users, I have a no route matches error. I understand why this is happening, Rails does not load routes of embers. Is there a solution to do it or is it just impossible with EmberCli-Rails for now?

1

There are 1 best solutions below

1
stephen.hanson On BEST ANSWER

Your Rails app needs a wildcard route so it knows to handle those requests through your Ember app controller. Can you try adding a route in routes.rb:

get '/:all', to: "ember#index"

substituting ember#index with whatever you have set up as the controller and action for your Ember app.