- Do not try to return properties from controllers, return the whole object.
- Eg: If you want to read a property of the first object of hasMany: do not return elements.firstObject.property. The hasMany are lazily loaded, thus not visible for models/controllers! The correct way is this: return the firstObject as computed property(elements.@each) and in the view bind the property. This way when the collection is lazy loaded, the view is notified and will update.
- Caution with collections in computed properties. You can observe the collection pointer or the collection elements(using @each)! They are different. Observing the collection pointer will notify when the collection is replaced or deleted, but not when an item is added! For this, you need to use @each.
- Displaying multiple model type on the same page is done with render(you can do it also with outlets but less clean).
- Observing a collection in order to apply a JQuery plugin is done using a CollectionView with a function observing content. In t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(App) { | |
App.Adapter = DS.RESTAdapter.extend({ | |
namespace: null, | |
serializer: DS.RESTSerializer.extend({ | |
primaryKey: function() { | |
return '_id'; |
The Ember router is getting number of enhancements that will greatly enhance its power, reliability, predictability, and ability to handle asynchronous loading logic (so many abilities), particularly when used in conjunction with promises, though the API is friendly enough that a deep understanding of promises is not required for the simpler use cases.
- see https://gist.github.com/machty/5723945 for the latest API (unlikely to change from now on)
- latest Ember build: https://machty.s3.amazonaws.com/ember/ember-async-routing-10.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt-get update | |
# Now let's install all the required ubuntu packages | |
sudo apt-get install build-essential uwsgi nginx uwsgi-plugin-python python-pip | |
# PS! If you are doing this stuff for fun I do recommend to install nginx from PPA repository | |
# that you can find here https://launchpad.net/~nginx/+archive/development |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Working on getting html5sortable plugin working | |
// Key part is needing to call the sortable() method using Ember.run.next | |
// If called straight away the functionality quickly gets applied, but then is lost | |
// At least that's what it looks like when stepping through chrome debugger | |
// http://farhadi.ir/projects/html5sortable/ | |
App.SortableView = Ember.CollectionView.extend({ | |
tagName: 'ul', | |
itemViewClass: 'App.SortableItemView', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Last commit: 36d2e2a (2013-03-11 17:37:25 -0700) | |
(function() { | |
window.DS = Ember.Namespace.create({ | |
// this one goes past 11 | |
CURRENT_API_REVISION: 12 | |
}); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Version: v1.0.0-pre.4-55-g11ab37f | |
// Last commit: 11ab37f (2013-01-27 14:30:02 -0800) | |
(function() { | |
/*global __fail__*/ | |
/** | |
Ember Debug |