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

巧了我就是萌 提交于 2019-12-13 02:58:11

问题


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:


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.



来源:https://stackoverflow.com/questions/32168466/ember-cli-rails-no-route-match-for-embers-paths

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!