Skip to content

Instantly share code, notes, and snippets.

@danfinlay
danfinlay / Team.js
Last active August 29, 2015 13:59
A tricky problem involved named through associations in Geddy's Model. This current arrangement throws the error `Error: The property "adminTeamTeamId" is not a valid property on the TeamAdmin model.`
var Team = function () {
this.hasMany('TeamUsers');
this.hasMany('Users', {through: 'TeamUsers'});
this.hasMany('TeamAdmins');
this.hasMany('Admins', {
through: 'TeamAdmins',
model: 'Users'
});
@danfinlay
danfinlay / gist:d49a20c73be39d84ebc0
Last active August 29, 2015 14:01
Strange Geddy Crash, started unexpectedly, persists after rolling back my git to working moments.
SyntaxError: Unexpected end of input
at Object.parse (native)
at Filesystem._getDatastore (/Users/dan/.node/lib/node_modules/geddy/lib/sessions/stores/filesystem.js:69:19)
at Filesystem.read (/Users/dan/.node/lib/node_modules/geddy/lib/sessions/stores/filesystem.js:49:26)
at init (/Users/dan/.node/lib/node_modules/geddy/lib/sessions/index.js:95:19)
at null._onTimeout (/Users/dan/.node/lib/node_modules/geddy/lib/sessions/index.js:66:10)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
@danfinlay
danfinlay / gist:b99b375c003df510537a
Created June 2, 2014 21:18
Failing use case for the current Geddy Model eager-association branch
var Thing = geddy.model.AnyModelYouWant;
Thing.all({}, {limit:3}, function(err, things){
if(err) throw err;
var thingIds = things.map(function(t){return t.id;});
Thing.all({id: thingIds}, function(err, sameThings){
if(err) throw err;
assert(things.length === sameThings.length, "Querying an array of IDs should return the same number of things.");
@danfinlay
danfinlay / CommandResult
Created June 16, 2014 19:31
Unusual Bug!
$ geddy jake db:init environment=test --trace
Setting up DB support for postgres adapter, test environment...
pg lib found in app's package.json, skipping installation.
jake aborted.
TypeError: Cannot set property 'Comment' of undefined
at done (/home/travis/.nvm/v0.10.26/lib/node_modules/geddy/lib/init/model.js:91:36)
at /home/travis/.nvm/v0.10.26/lib/node_modules/geddy/lib/init/model.js:102:20
at /home/travis/.nvm/v0.10.26/lib/node_modules/geddy/node_modules/model/lib/adapters/sql/postgres.js:57:9
@danfinlay
danfinlay / gist:d76923f677bed1784c57
Created June 16, 2014 20:46
SQL error on geddy/master
var Article = geddy.model.Article;

Article.all({featured: false}
  , {"limit":50,"skip":0,"includes":["Comment","User"],"sort":{"createdAt":"desc"}}
  , callback);

Creates:

@danfinlay
danfinlay / Reserved-words.md
Last active April 26, 2017 12:36
Reserved words in Ember & Ember Data

I've run into a number of words you can't use in Ember, and I want to keep track of them so others don't use them in the future. Here's my list to date:

  1. data
  2. currentState
  3. state
@danfinlay
danfinlay / gist:4ea194e23843a0bede12
Last active August 29, 2015 14:02
Problematic Unit Test in Ember needs some kind of Ember.run() application.
test('Post has a user', function() {
expect(1);
var store = this.container.lookup('store:main');
var Post = this.container.lookupFactory('model:post');
var User = this.container.lookupFactory('model:user');
var user = store.createRecord('user', {name:"Bob"});
var post = store.createRecord('post', {
body:"Hey!",
@danfinlay
danfinlay / Brocfile.js
Created June 25, 2014 19:58
7 second Broccoli Build
/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var app = new EmberApp({
name: require('./package.json').name,
es3Safe: false,
minifyCSS: {
enabled: true,
@danfinlay
danfinlay / package.json
Created June 25, 2014 20:01
7s Broccoli Build
{
"name": "my-app",
"version": "0.0.0",
"private": true,
"namespace": "appkit",
"APIMethod": "stub",
"proxyURL": "http://localhost:4021",
"proxyPath": "/api",
@danfinlay
danfinlay / bower.json
Created June 25, 2014 20:04
7s Broccoli Build
{
"name": "my-app",
"dependencies": {
"handlebars": "~1.3.0",
"jquery": "^1.11.1",
"qunit": "~1.12.0",
"ember-qunit": "~0.1.5",
"ember": "components/ember#canary",
"ember-data": "1.0.0-beta.8",
"ember-resolver": "~0.1.1",