Skip to content

Commit

Permalink
[BUGFIX] Retrieve the last element properly from ED relationships
Browse files Browse the repository at this point in the history
  • Loading branch information
btecu committed Oct 27, 2016
1 parent d0b5716 commit b567766
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion addon/components/x-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ export default Component.extend(BusPublisherMixin, {
case 8: { // Backspace
let values = this.get('values');
if (isPresent(values) && this.get('token') === '') {
this.attrs.onRemove(values[values.length - 1]);
let last = values.lastObject
? values.get('lastObject')
: values[values.length - 1];

this.attrs.onRemove(last);
}

break;
Expand Down

0 comments on commit b567766

Please sign in to comment.