Skip to content

Instantly share code, notes, and snippets.

Ember Computed Literal Backwards Compatibility Blocker

[Ember.computed.literal][1] is blocked on a backwards compatibility story. There are basically three options:

  1. Breaking change for consistency, deprecating existing behaviour;
  2. More complicated temporary solution for backwards compatibility (ember only); and
  3. More complicated temporary solution for backwards compatibility (ember and ember-cpm).

TL;DR

  1. user.get('posts') should resolve as soon as the ids are known, possibly before the records are loaded;
  2. user.get('posts').objectAt(0) should return a PromiseObject and also fetch that object;
  3. The fetches from #2 should be coalesced and;
  4. user.get('posts').load() should fetch the records and return a promise that resolves when they are all loaded.

Consider the example:

var MyObject = Ember.Object.extend({
  selectedContent: Ember.computed.filterBy('content', 'isSelected')
});

var obj = MyObject.create({
  content: [
    Em.Object.create({name: "one", isSelected: false}),
 Em.Object.create({name: "two", isSelected: false})
" for filetype rspec

if !exists("*s:RunSpec")
  function s:RunSpec()
    let command="tmux send-keys -t bottom-left zeus " . "' '" . "rspec\ " . "' '" . expand("%") . ":" . line(".") . "$'\n'"
    let g:last_spec_command=command

 echo system(command)
export function filterBy (dependentKey, propertyKey, filterPropertyName) {
var callback;
if (arguments.length === 2) {
callback = function(item) {
return get(item, propertyKey);
};
} else {
callback = function(item) {
return get(item, propertyKey) === get(this, filterPropertyName);
@hjdivad
hjdivad / controllers.application.js
Last active August 29, 2015 14:27
nested array depkey
import Ember from 'ember';
const computed = Ember.computed;
const Inner = Ember.Object.extend({
people: null,
});
const Person = Ember.Object.extend({
name: null,
We couldn’t find that file to show.
$ bundle --version
Bundler version 1.0.10
$ cat Gemfile
source "http://rubygems.org"
gem 'ruby-debug-ide19'
gem 'ruby-debug19'
$ bundle --version
Bundler version 1.0.10
$ cat Gemfile
source "http://rubygems.org"
gem 'ruby-debug19'
gem 'ruby-debug-ide19'
div = document.createElement('div');
div.innerHTML = '<span value="6512448364123" />';
div.innerHTML // => "<span value="6512448364123"></span>";
div = document.createElement('div');
div.innerHTML = '<li value="6512448364123" />';
div.innerHTML // => "<li value="2147483647"></li>"