Skip to content

Instantly share code, notes, and snippets.

@danfinlay
Created July 25, 2014 18:42
Show Gist options
  • Select an option

  • Save danfinlay/7f669be8665adc646ce2 to your computer and use it in GitHub Desktop.

Select an option

Save danfinlay/7f669be8665adc646ce2 to your computer and use it in GitHub Desktop.
geddy.model.log = console.log;
geddy.model.User.all({'newsPosts.body':{like:'%Lorem%'}}
, {includes:'NewsPost'}
, function(err, users){
console.log(err);
console.log(users);
});
SELECT"users"."id" AS "User#id", "users"."created_at" AT TIME ZONE 'UTC' AS "user#createdAt", "users"."updated_at" AT TIME ZONE 'UTC' AS "user#updatedAt","user#newsPost"."id" AS "user#newsPost#id", "user#newsPost"."created_at" AT TIME ZONE 'UTC' AS "user#newsPost#createdAt", "user#newsPost"."updated_at" AT TIME ZONE 'UTC' AS "user#newsPost#updatedAt", "user#newsPost"."body" AS "user#newsPost#body", "user#newsPost"."user_id" AS "user#newsPost#userId", "user#newsPost"."user_id" AS "user#newsPost#userId"
FROM users users
LEFT OUTER JOIN "newsPosts" "user#newsPost" ON ("users"."id" = "User#newsPost"."user_id")
WHERE ("user#newsPosts"."body" LIKE '%Lorem%')
ORDER BY users."id" ASC
;
error: missing FROM-clause entry for table "User#newsPosts"
at Connection.parseE (/Project/node_modules/pg/lib/connection.js:561:11)
at Connection.parseMessage (/Project/node_modules/pg/lib/connection.js:390:17)
(See full trace by running task with --trace)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment