ruby-on-rails – 无效的fullName:`model:@ each`,必须是`type
发布时间:2020-12-17 03:29:17 所属栏目:百科 来源:网络整理
导读:我在 this tutorial之后使用Ember CLI和Rails后端设置了一个新的应用程序但是当我为我的某个模型设置路由时,我收到以下错误: Error while processing route: inks.index Invalid fullName: `model:@each`,must be of the form `type:name` TypeError: Inval
我在
this tutorial之后使用Ember CLI和Rails后端设置了一个新的应用程序但是当我为我的某个模型设置路由时,我收到以下错误:
Error while processing route: inks.index Invalid fullName: `model:@each`,must be of the form `type:name` TypeError: Invalid fullName: `model:@each`,must be of the form `type:name` at __exports__.default.EmberObject.extend.resolve (http://localhost:4200/assets/vendor.js:16772:17) at Object.resolve [as resolver] (http://localhost:4200/assets/vendor.js:16394:25) at resolve (http://localhost:4200/assets/vendor.js:14930:32) at Object.Container.resolve (http://localhost:4200/assets/vendor.js:14510:16) at factoryFor (http://localhost:4200/assets/vendor.js:15013:31) at Object.Container.lookupFactory (http://localhost:4200/assets/vendor.js:14617:16) at Ember.Object.extend.modelFactoryFor (http://localhost:4200/assets/vendor.js:74810:31) at JSONSerializer.extend.extractArray (http://localhost:4200/assets/vendor.js:67710:22) at apply (http://localhost:4200/assets/vendor.js:32851:27) at superWrapper (http://localhost:4200/assets/vendor.js:32419:15) 我用Google搜索,但我不知道它甚至意味着什么.我已经检查过以确保我有ActiveModelAdapter和Serializer.该模型并不复杂: 我的路线是app / routes / users / index.js: import Ember from 'ember'; export default Ember.Route.extend({ model: function() { return this.store.find('user'); } }); 应用程序/ router.js: import Ember from 'ember'; import config from './config/environment'; var Router = Ember.Router.extend({ location: config.locationType }); Router.map(function() { this.resource('users'); }); export default Router; 我的app / adapters / application.js是: import DS from 'ember-data'; export default DS.ActiveModelAdapter.extend({ namespace: 'api/v1' }); 我对EmberCLI还很新,所以我不确定在哪里看. 解决方法
我遇到了类似的问题.只有一个区别我用了
rabl.
问题出在我的rabl配置上: Rabl.configure do |config| config.include_json_root = false end Ember.js documentation告诉我们:
因此,您需要将rabl配置更改为: Rabl.configure do |config| config.include_json_root = true end 或者,在rabl模板中传递root选项: collection @orders,root: 'orders' (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |