artemave / ar-bug

Demonstrates a bug in ActiveRecord

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setup

Clone, bundle install, rake db:create db:migrate

Demo

In rails c:


> p = Post.create!
> u = User.create!
> p.comments.where(user: u.followers)
  Comment Load (0.4ms)  SELECT "comments".* FROM "comments"  WHERE "comments"."post_id" = $1 AND "comments"."user_id" IN (SELECT "users"."id" FROM "users" INNER JOIN "user_relationships" ON "users"."id" = "user_relationships"."follower_id" WHERE "user_relationships"."following_user_id" = $1)  [["post_id", 2], ["following_user_id", 2]]
  PG::ProtocolViolation: ERROR:  bind message supplies 2 parameters, but prepared statement "a1" requires 1

About

Demonstrates a bug in ActiveRecord


Languages

Language:Ruby 93.4%Language:JavaScript 3.6%Language:CSS 3.0%