Javascript EmberJS是否支持单字母单词模型?

Javascript EmberJS是否支持单字母单词模型?,javascript,ember.js,Javascript,Ember.js,我真的无法确定问题是与余烬还是余烬数据有关,或者甚至是一个问题,但下面是发生的情况: 假设您的模型名为告诉我一个故事。如果您使用的是ActiveModelAdapter,那么JSON应该提供这个名称 无论如何,当余烬或余烬数据在内部处理它时,它将对其进行camelize处理,并成为tellMeAStory,正确地指示“A”和“Story”是两个独立的单词 但是,当在内部对其进行decamelize以查找模型时,decamelize函数会将其转换为告诉我\u astory 在我看来,这最后一个行为

我真的无法确定问题是与余烬还是余烬数据有关,或者甚至是一个问题,但下面是发生的情况:

假设您的模型名为
告诉我一个故事
。如果您使用的是ActiveModelAdapter,那么JSON应该提供这个名称

无论如何,当余烬或余烬数据在内部处理它时,它将对其进行camelize处理,并成为
tellMeAStory
,正确地指示“A”和“Story”是两个独立的单词

但是,当在内部对其进行decamelize以查找模型时,decamelize函数会将其转换为
告诉我\u astory

在我看来,这最后一个行为似乎有缺陷,但当查看衍生这一行为的测试时,它实际上是为了以这种方式管理首字母缩略词。(将下面的示例与“innerHtml”进行比较,我希望使用驼峰式大小写多字母首字母缩写词。)

()

那么,在带有余烬的模型中使用单字母单词的正确方法是什么?他们是否得到支持?


下面是我尝试做的一个例子:

// this comes from a separate data source, e.g. REST APIs
var myModelName = 'tell_me_a_story';
// this line will throw if the model file is named "tell-me-a-story"
if (!store.getById(myModelName, 1)) {
  // this line will throw if the model file is named "tell-me-astory"
  store.pushPayload(myModelName, myObject);
}

您可以覆盖存储,然后更改camelCase行为,使其成为您想要的(例如,dasherized或仅修复这一个案例)

您还可以在换一种方式时覆盖序列化程序-这使您可以告诉ember数据中某个特定键的模型键是什么(例如,
tellMeAStory
)(例如,
tell\u me\u story


似乎正在进行工作,以使所有内容都像容器一样工作(虚线化)

这在我看来像个bug。如果我是你,我会报告的。然后,
innerHTML
会变成
inner\u h\u t\u m\u l
,这也会很奇怪:)。
// this comes from a separate data source, e.g. REST APIs
var myModelName = 'tell_me_a_story';
// this line will throw if the model file is named "tell-me-a-story"
if (!store.getById(myModelName, 1)) {
  // this line will throw if the model file is named "tell-me-astory"
  store.pushPayload(myModelName, myObject);
}