{"id":1493,"date":"2022-08-30T15:16:59","date_gmt":"2022-08-30T15:16:59","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/23\/transition-was-aborted-while-resolving-model-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:16:59","modified_gmt":"2022-08-30T15:16:59","slug":"transition-was-aborted-while-resolving-model-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/transition-was-aborted-while-resolving-model-collection-of-common-programming-errors\/","title":{"rendered":"Transition was aborted while resolving model-Collection of common programming errors"},"content":{"rendered":"<p>I have a simple application which must display a list of JSON objects Data properly. After I navigate to the index page and I click on link &#8220;Risk types&#8221; I come up with the following set of errors (from the Chrome Ember inspector):<\/p>\n<pre><code>DEPRECATION: Action handlers contained in an events object are deprecated in favor of putting them in an actions object (error on )\n\nError while loading route\n\nUncaught #Object\n<\/code><\/pre>\n<p>I suspect the error originates from my store definition. When I define modified the route&#8217;s model as<\/p>\n<pre><code>var mod = rt;\n<\/code><\/pre>\n<p>instead of<\/p>\n<pre><code>var mod = this.store.findAll('risktype');\n<\/code><\/pre>\n<p>everything works fine.<\/p>\n<p>The response (an array of 2 JSon objects) comes from a Java servlet on a Tomcat server. The trace (attached) shows that responseText is correctly obtained from returned by the backend server.<\/p>\n<p>Does anyone has a clue about it?<\/p>\n<p>Here is my code:<\/p>\n<pre><code>var App = Ember.Application.create({\n    LOG_TRANSITIONS: true,\n    LOG_TRANSITIONS_INTERNAL: true,\n});\n\nApp.Router.map(function () {\n  this.route('risktypes', {path: '\/risktypes'});\n});\n\nApp.RisktypesRoute = Ember.Route.extend({\n    model: function() {\n        var mod = this.store.findAll('risktype');\n    \/\/    var mod = rt;\n        return mod;\n    }\n});\n\nvar rt = [ { 'id': 1011, 'code': 'CODE1', 'description': 'Type 1', 'state': 'NEW' },\n           { 'id': 2021, 'code': 'CODE2', 'description': 'Type 2', 'state': 'VALID' }]\n\nApp.RisktypesController = Ember.ArrayController.extend();\n\nApp.Store = DS.Store.extend({\n    adapter: DS.RESTAdapter.extend({\n        namespace: 'ember-profiler-webapp\/app'\n    })\n\/\/  , revision: 1\n});\n\nApp.store = App.Store.create();\n\nApp.Risktype = DS.Model.extend({\n    code: DS.attr('string'),\n    description: DS.attr('string'),\n    state: DS.attr('string')\n})\n\n\nHere is file index.html:\n\n\n\n\n  \n  \n\n  \n  \n  \n  \n  \n\n  \n    \n    <\/code><\/pre>\n<h1><code>(application)<\/code><\/h1>\n<pre>\n    {{outlet}}\n    \n  \n\n  \n  <\/pre>\n<h1><code>(index)<\/code><\/h1>\n<pre>\n  <\/pre>\n<h2><code>This is the index template.<\/code><\/h2>\n<pre>\n  {{#link-to 'risktypes'}}\n    Risk types\n  {{\/link-to}}\n\n\n\n  <\/pre>\n<h2><code>This is the risktypes template.<\/code><\/h2>\n<pre>\n  <\/pre>\n<p>{{#each controller}} {{\/each}}<\/p>\n<table>\n<tr>\n<th>Code<\/th>\n<th>Description<\/th>\n<th>State<\/th>\n<\/tr>\n<tr>\n<td>{{code}}<\/td>\n<td>{{description}}<\/td>\n<td>{{state}}<\/td>\n<\/tr>\n<\/table>\n<p>Error message below Modifying into the trace &#8220;Error while loading route&#8221; following made no improvement:<\/p>\n<pre><code>Object {readyState: 4, getResponseHeader: function, getAllResponseHeaders: function, setRequestHeader: function, overrideMimeType: function.}\nabort: function ( statusText ) {\nalways: function () {\ncomplete: function () {\ndone: function () {\nerror: function () {\nfail: function () {    \ngetAllResponseHeaders: function () {\ngetResponseHeader: function ( key ) {\noverrideMimeType'risktypes': function ( type ) {\npipe: function ( \/* fnDone, fnFail, fnProgress *\/ ) {\nprogress: function () {[\npromise: function ( obj ) {\nreadyState: 4\nresponseText: \"[ { 'id': 1011, 'code': 'CODE1', 'description': 'Type 1', 'state': 'NEW' },\n                 { 'id': 2021, code''code': 'CODE2', 'description': 'Type 2', 'state': 'VALID' }]\"\nsetRequestHeader: function ( name, value ) {\nstate: function () {\nstatus: 200\nstatusCode: function ( map ) {\nstatusText: \"OK\"\nsuccess: function () {\nthen: null]\n__proto__: Object}\n<\/code><\/pre>\n<p>It looks like I am not using Ember Data properly.<\/p>\n<p>I modified the JSon objects returned by the backend server. Was:<\/p>\n<pre><code>[ \n  { 'id': 11, 'code': 'CODE1', 'description': 'Type 1', 'state': 'NEW' },\n  { 'id': 21, 'code': 'CODE2', 'description': 'Type 2', 'state': 'VALID' }\n]\n<\/code><\/pre>\n<p>Modifying into the following made no change:<\/p>\n<pre><code>{ 'risktypes':  \n [\n   { 'id': 11, 'code': 'CODE1', 'description': 'Type 1', 'state': 'NEW' },\n   { 'id': 21, 'code': 'CODE2', 'description': 'Type 2', 'state': 'VALID' }\n ]\n}\n<\/code><\/pre>\n<p>Does anyone have a hint for this? It would be a shame to switch to Angular.js for such a trivial beginner error!<\/p>\n<p>Thanks<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-23 09:51:07. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I have a simple application which must display a list of JSON objects Data properly. After I navigate to the index page and I click on link &#8220;Risk types&#8221; I come up with the following set of errors (from the Chrome Ember inspector): DEPRECATION: Action handlers contained in an events object are deprecated in favor [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1493","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1493"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1493\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}