0

残り火rc1。ルートに関する命名規則によってビューが自動的にインスタンス化される方法がわかりません。

次のリソースが定義されています。

  this.resource('groups', { path : '/groups' }, function() {
      this.resource('received', { path : '/received' }, function() {            
        this.route('show', { path : '/:asset_link_group_id' });
  });

ルーターが groups/received/index のビューをインスタンス化するとき、ReceivedIndexView という名前のビューを探します。GroupsReceivedIndexView ではないのはなぜですか?

同じことがコントローラーにも当てはまります。GroupsReceivedIndexController ではなく、ReceivedIndexController を探します。なぜ?

4

2 に答える 2

0

「リソースの下にネストされたルートは、リソースの名前とその名前をルート名として使用します」、http://emberjs.com/guides/routing/defining-your-routes/から

セットアップについての私の理解では、パッチを自動的に導出するために、ルートが調べられ、次にそれが親リソースになるということです。このように、 /resource1/sameresourcename/new および /resource2/sameresourcename/new は、これらのパス/名前を生成するために完全な「ツリー」を使用しないため、実際に問題を引き起こします。

于 2013-03-27T14:01:30.127 に答える
0

I spent a lot of time researching this as i was having problems understanding the hows and whys of the naming conventions. This is the most informative site I have found in regards to which pieces of the route/resources are picked to create the view/controller/resource name.

From Peter "We intentionally only nest one level deep. The correct solution is what @jamesarosen suggested."

https://github.com/emberjs/ember.js/issues/2086

于 2013-11-08T16:00:22.343 に答える