Skip to content

Instantly share code, notes, and snippets.

View bradleypriest's full-sized avatar

Bradley Priest bradleypriest

View GitHub Profile
<script type="text/x-handlebars">
<button {{action loadBooks target="Welcome.booksController"}}>Load Books</button>
{{#collection contentBinding="Welcome.booksController" tagName="ul"}}
<b>{{view.content.title}}</b> - {{view.content.author}}, <i>{{view.content.genre}}</i>
{{/collection}}
</script>
@bradleypriest
bradleypriest / router.js
Created July 11, 2012 07:40 — forked from Neppord/router.js
How does the automatic find binding work?
App.Router = Em.Router.extend({
root: Em.Route.extend({
route: '/',
user: Em.Route.extend({
route: '/:user_id/',
connectOutlets: function (router, context) {
//What is context here?
// it's simple in the one segment case where
// its the return value of find on the model.
},
@bradleypriest
bradleypriest / bound_helper.js
Created May 3, 2012 08:23 — forked from ghempton/bound_helper.js
Ember Bound Handlebars Helper Utility
// For reference: https://github.com/wagenet/ember.js/blob/ac66dcb8a1cbe91d736074441f853e0da474ee6e/packages/ember-handlebars/lib/views/bound_property_view.js
var BoundHelperView = Ember._MetamorphView.extend({
context: null,
options: null,
property: null,
// paths of the property that are also observed
propertyPaths: [],
value: Ember.K,
@bradleypriest
bradleypriest / active_record.rb
Created March 22, 2012 20:01 — forked from jcf/active_record.rb
Backport pluck to Rails 3.0/3.1
# config/initializers/extensions/active_record.rb
module ActiveRecord
class Base
class << self
delegate :pluck, to: :scoped
end
end
class CollectionProxy
delegate :pluck, to: :scoped