问题描述
在Rails和Ember项目中,我决定使用,因为我想做一个集合测试与水豚和我所有最喜欢的测试宝石。
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.
我在ember上添加路由:
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
当我去 http:// localhost:3000 / users
,我有一个没有路由匹配的错误。我明白为什么会发生这种情况,Rails没有加载余烬的路线。有没有办法解决这个问题,或者EmberCli-Rails现在是不可能的吗?
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?
推荐答案
您的Rails应用需要一个通配符路由,所以它知道通过您的Ember应用程序控制器处理这些请求。您可以尝试在 routes.rb中添加路线
:
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"
替换 ember#索引
,无论您设置为Ember应用程序的控制器和操作。
substituting ember#index
with whatever you have set up as the controller and action for your Ember app.
这篇关于Ember-cli-rails没有符合Ember路径的路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!