# Logfile created on Mon Apr 18 11:01:48 -0400 2011 by logger.rb/22285 SQL (0.3ms) SET client_min_messages TO 'ERROR' SQL (0.1ms) SET client_min_messages TO 'panic' SQL (0.1ms) SET standard_conforming_strings = on SQL (0.1ms) SET client_min_messages TO 'error' SQL (23.4ms) DROP TABLE "blog_entries" SQL (119.1ms) CREATE TABLE "blog_entries" ("id" serial primary key, "blog_id" integer NOT NULL, "entry_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (58.5ms) CREATE INDEX "blog_entries_by_firm" ON "blog_entries" ("owner_firm_id") SQL (76.9ms) CREATE INDEX "blog_entries_by_owner" ON "blog_entries" ("owner_id") SQL (21.1ms) DROP TABLE "blogs" SQL (84.0ms) CREATE TABLE "blogs" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (65.5ms) CREATE INDEX "blogs_by_firm" ON "blogs" ("owner_firm_id") SQL (50.3ms) CREATE INDEX "blogs_by_owner" ON "blogs" ("owner_id") SQL (84.6ms) CREATE UNIQUE INDEX "ix_blogs_by_name_owner_firm" ON "blogs" ("name", "owner_firm_id") SQL (21.1ms) DROP TABLE "entry_comments" SQL (106.5ms) CREATE TABLE "entry_comments" ("id" serial primary key, "blog_entry_id" integer, "comment_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (50.6ms) CREATE INDEX "entry_comments_by_firm" ON "entry_comments" ("owner_firm_id") SQL (74.3ms) CREATE INDEX "entry_comments_by_owner" ON "entry_comments" ("owner_id") SQL (8.6ms) DROP TABLE "firms" SQL (86.6ms) CREATE TABLE "firms" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (9.0ms) DROP TABLE "pcheck_log_entries" SQL (95.4ms) CREATE TABLE "pcheck_log_entries" ("id" serial primary key, "request_log_entry_id" integer NOT NULL, "success" boolean NOT NULL, "model_class" character varying(100) NOT NULL, "model_id" integer, "privilege" character varying(40) NOT NULL, "user_id" integer NOT NULL, "user_name" character varying(100) NOT NULL, "created_at" timestamp, "updated_at" timestamp)  SQL (19.9ms) DROP TABLE "permissions" SQL (84.7ms) CREATE TABLE "permissions" ("id" serial primary key, "role_id" integer, "is_grant" boolean NOT NULL, "has_grant_option" boolean NOT NULL, "class_name" character varying(40) NOT NULL, "privilege" character varying(40) NOT NULL, "target_owned_by_self" boolean NOT NULL, "target_owner_id" integer, "target_owner_firm_id" integer, "target_id" integer, "target_name" character varying(100), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (83.4ms) CREATE INDEX "index_permissions_on_role_id" ON "permissions" ("role_id") SQL (19.8ms) DROP TABLE "request_log_entries" SQL (118.1ms) CREATE TABLE "request_log_entries" ("id" serial primary key, "created_at" timestamp, "updated_at" timestamp, "acting_user_id" integer, "user_of_record_id" integer, "acting_user_name" character varying(255), "user_of_record_name" character varying(255), "controller" character varying(100) NOT NULL, "action" character varying(100) NOT NULL, "http_method" character varying(50) NOT NULL, "status" character varying(100) NOT NULL, "model_class" character varying(100), "model_id" integer, "remote_ip" character varying(50))  SQL (8.7ms) DROP TABLE "role_assignments" SQL (86.4ms) CREATE TABLE "role_assignments" ("id" serial primary key, "user_id" integer NOT NULL, "role_id" integer NOT NULL, "default_user_id" integer, "default_firm_id" integer, "invalid_after" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (9.5ms) DROP TABLE "roles" SQL (108.3ms) CREATE TABLE "roles" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (63.4ms) CREATE INDEX "roles_by_firm" ON "roles" ("owner_firm_id") SQL (84.7ms) CREATE INDEX "roles_by_owner" ON "roles" ("owner_id") SQL (9.4ms) DROP TABLE "users" SQL (98.0ms) CREATE TABLE "users" ("id" serial primary key, "name" character varying(100) NOT NULL, "owner_firm_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (0.7ms) SELECT version FROM "schema_migrations" SQL (0.1ms) BEGIN Firm Load (0.6ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.5ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (1.1ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.4ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:01:51.206049', '2011-04-18 11:01:51.206049', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(5) SQL (1.4ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:01:51.223113', '2011-04-18 11:01:51.223113', 5, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.2ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:01:51.240596', '2011-04-18 11:01:51.240596', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.5ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 5' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 5', '2011-04-18 11:01:51.255243', '2011-04-18 11:01:51.255243', 5, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 6' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 6', '2011-04-18 11:01:51.265701', '2011-04-18 11:01:51.265701', 5, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.5ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 7' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 7', '2011-04-18 11:01:51.272915', '2011-04-18 11:01:51.272915', 3, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 8' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 8', '2011-04-18 11:01:51.279621', '2011-04-18 11:01:51.279621', 3, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.6ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 9' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 9', '2011-04-18 11:01:51.285522', '2011-04-18 11:01:51.285522', 4, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 10' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 10', '2011-04-18 11:01:51.291451', '2011-04-18 11:01:51.291451', 4, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.5ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:01:51.308506', 'f', NULL, NULL, '2011-04-18 11:01:51.308506', 3, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.4ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:01:51.321596', 'f', NULL, NULL, '2011-04-18 11:01:51.321596', 3, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.3ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:01:51.329849', 't', NULL, NULL, '2011-04-18 11:01:51.329849', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.4ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:01:51.339393', 'f', 1, 'mertz family blog', '2011-04-18 11:01:51.339393', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "permissions" WHERE ("permissions".role_id = 5)  Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions".role_id = 4)  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(5) SQL (1.4ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:01:51.356617', 'f', NULL, NULL, '2011-04-18 11:01:51.356617', 5, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:01:51.363688', "class_name" = 'Role' WHERE "id" = 90 SQL (1.6ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:01:51.373573' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:01:51.376265', "is_grant" = 't' WHERE "id" = 90 SQL (2.4ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (5.0ms) SAVEPOINT active_record_1 Permission Update (4.7ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:01:51.404816' WHERE "id" = 90 SQL (1.7ms) RELEASE SAVEPOINT active_record_1 Permission Update (5.3ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:01:51.413554', "privilege" = 'blurfl' WHERE "id" = 90 SQL (34.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (8.6ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:01:51.537354' WHERE "id" = 90 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:01:51.548761', "privilege" = 'any' WHERE "id" = 90 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (2.9ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (1.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:01:51.558324', "invalid_after" = '2011-04-18 11:01:50.945887' WHERE "id" = 22 SQL (5.7ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.3ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:01:51.570944', "invalid_after" = '2011-04-17 11:01:50.946247' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (5.8ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:01:51.581608', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (5.9ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:01:51.595229', "invalid_after" = '2011-04-19 11:01:50.946543' WHERE "id" = 22 SQL (0.3ms) RELEASE SAVEPOINT active_record_1 SQL (4.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.2ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:01:51.632805', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:01:51.637022' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (2.6ms) ROLLBACK SQL (0.3ms) SET client_min_messages TO 'ERROR' SQL (0.1ms) SET client_min_messages TO 'panic' SQL (0.1ms) SET standard_conforming_strings = on SQL (0.1ms) SET client_min_messages TO 'error' SQL (61.9ms) DROP TABLE "blog_entries" SQL (110.6ms) CREATE TABLE "blog_entries" ("id" serial primary key, "blog_id" integer NOT NULL, "entry_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (60.5ms) CREATE INDEX "blog_entries_by_firm" ON "blog_entries" ("owner_firm_id") SQL (66.1ms) CREATE INDEX "blog_entries_by_owner" ON "blog_entries" ("owner_id") SQL (10.3ms) DROP TABLE "blogs" SQL (74.6ms) CREATE TABLE "blogs" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (63.1ms) CREATE INDEX "blogs_by_firm" ON "blogs" ("owner_firm_id") SQL (62.9ms) CREATE INDEX "blogs_by_owner" ON "blogs" ("owner_id") SQL (62.1ms) CREATE UNIQUE INDEX "ix_blogs_by_name_owner_firm" ON "blogs" ("name", "owner_firm_id") SQL (9.9ms) DROP TABLE "entry_comments" SQL (129.4ms) CREATE TABLE "entry_comments" ("id" serial primary key, "blog_entry_id" integer, "comment_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (52.0ms) CREATE INDEX "entry_comments_by_firm" ON "entry_comments" ("owner_firm_id") SQL (59.1ms) CREATE INDEX "entry_comments_by_owner" ON "entry_comments" ("owner_id") SQL (9.0ms) DROP TABLE "firms" SQL (76.1ms) CREATE TABLE "firms" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (16.4ms) DROP TABLE "pcheck_log_entries" SQL (68.3ms) CREATE TABLE "pcheck_log_entries" ("id" serial primary key, "request_log_entry_id" integer NOT NULL, "success" boolean NOT NULL, "model_class" character varying(100) NOT NULL, "model_id" integer, "privilege" character varying(40) NOT NULL, "user_id" integer NOT NULL, "user_name" character varying(100) NOT NULL, "created_at" timestamp, "updated_at" timestamp)  SQL (9.2ms) DROP TABLE "permissions" SQL (75.3ms) CREATE TABLE "permissions" ("id" serial primary key, "role_id" integer, "is_grant" boolean NOT NULL, "has_grant_option" boolean NOT NULL, "class_name" character varying(40) NOT NULL, "privilege" character varying(40) NOT NULL, "target_owned_by_self" boolean NOT NULL, "target_owner_id" integer, "target_owner_firm_id" integer, "target_id" integer, "target_name" character varying(100), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (52.1ms) CREATE INDEX "index_permissions_on_role_id" ON "permissions" ("role_id") SQL (20.4ms) DROP TABLE "request_log_entries" SQL (97.3ms) CREATE TABLE "request_log_entries" ("id" serial primary key, "created_at" timestamp, "updated_at" timestamp, "acting_user_id" integer, "user_of_record_id" integer, "acting_user_name" character varying(255), "user_of_record_name" character varying(255), "controller" character varying(100) NOT NULL, "action" character varying(100) NOT NULL, "http_method" character varying(50) NOT NULL, "status" character varying(100) NOT NULL, "model_class" character varying(100), "model_id" integer, "remote_ip" character varying(50))  SQL (8.9ms) DROP TABLE "role_assignments" SQL (64.2ms) CREATE TABLE "role_assignments" ("id" serial primary key, "user_id" integer NOT NULL, "role_id" integer NOT NULL, "default_user_id" integer, "default_firm_id" integer, "invalid_after" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (12.1ms) DROP TABLE "roles" SQL (62.3ms) CREATE TABLE "roles" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (49.7ms) CREATE INDEX "roles_by_firm" ON "roles" ("owner_firm_id") SQL (63.4ms) CREATE INDEX "roles_by_owner" ON "roles" ("owner_id") SQL (8.6ms) DROP TABLE "users" SQL (64.4ms) CREATE TABLE "users" ("id" serial primary key, "name" character varying(100) NOT NULL, "owner_firm_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (0.6ms) SELECT version FROM "schema_migrations" SQL (0.1ms) BEGIN Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.5ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (1.7ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.6ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:03:19.242624', '2011-04-18 11:03:19.242624', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(5) SQL (2.0ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.7ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:03:19.264679', '2011-04-18 11:03:19.264679', 5, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.7ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.6ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:03:19.289400', '2011-04-18 11:03:19.289400', 4, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.7ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 Blog Load (0.7ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 5' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.6ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 5', '2011-04-18 11:03:19.310457', '2011-04-18 11:03:19.310457', 5, 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.5ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 Blog Load (0.6ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 6' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 6', '2011-04-18 11:03:19.326541', '2011-04-18 11:03:19.326541', 5, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 7' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 7', '2011-04-18 11:03:19.334547', '2011-04-18 11:03:19.334547', 3, 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 8' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 8', '2011-04-18 11:03:19.342373', '2011-04-18 11:03:19.342373', 3, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 Blog Load (0.6ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 9' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.6ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 9', '2011-04-18 11:03:19.351048', '2011-04-18 11:03:19.351048', 4, 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 10' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 10', '2011-04-18 11:03:19.359340', '2011-04-18 11:03:19.359340', 4, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.8ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:03:19.379355', 'f', NULL, NULL, '2011-04-18 11:03:19.379355', 3, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.8ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:03:19.397683', 'f', NULL, NULL, '2011-04-18 11:03:19.397683', 3, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.8ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:03:19.409155', 't', NULL, NULL, '2011-04-18 11:03:19.409155', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.8ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:03:19.420420', 'f', 1, 'mertz family blog', '2011-04-18 11:03:19.420420', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.5ms) SELECT count(*) AS count_all FROM "permissions" WHERE ("permissions".role_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE ("permissions".role_id = 4)  SQL (2.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(5) SQL (2.1ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:03:19.444565', 'f', NULL, NULL, '2011-04-18 11:03:19.444565', 5, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.5ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:03:19.451786', "class_name" = 'Role' WHERE "id" = 90 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:03:19.460620' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.3ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:03:19.463154', "is_grant" = 't' WHERE "id" = 90 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:03:19.471895' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.3ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:03:19.474379', "privilege" = 'blurfl' WHERE "id" = 90 SQL (12.7ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:03:19.525075' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:03:19.527613', "privilege" = 'any' WHERE "id" = 90 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:03:19.533643', "invalid_after" = '2011-04-18 11:03:19.038781' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:03:19.538910', "invalid_after" = '2011-04-17 11:03:19.039128' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:03:19.543702', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:03:19.549441', "invalid_after" = '2011-04-19 11:03:19.039377' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.2ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:03:19.569429', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:03:19.573120' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) ROLLBACK SQL (0.3ms) SET client_min_messages TO 'ERROR' SQL (0.1ms) SET client_min_messages TO 'panic' SQL (0.1ms) SET standard_conforming_strings = on SQL (0.1ms) SET client_min_messages TO 'error' SQL (13.4ms) DROP TABLE "blog_entries" SQL (117.9ms) CREATE TABLE "blog_entries" ("id" serial primary key, "blog_id" integer NOT NULL, "entry_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (58.4ms) CREATE INDEX "blog_entries_by_firm" ON "blog_entries" ("owner_firm_id") SQL (74.1ms) CREATE INDEX "blog_entries_by_owner" ON "blog_entries" ("owner_id") SQL (18.5ms) DROP TABLE "blogs" SQL (77.8ms) CREATE TABLE "blogs" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (55.0ms) CREATE INDEX "blogs_by_firm" ON "blogs" ("owner_firm_id") SQL (62.1ms) CREATE INDEX "blogs_by_owner" ON "blogs" ("owner_id") SQL (62.0ms) CREATE UNIQUE INDEX "ix_blogs_by_name_owner_firm" ON "blogs" ("name", "owner_firm_id") SQL (13.0ms) DROP TABLE "entry_comments" SQL (116.3ms) CREATE TABLE "entry_comments" ("id" serial primary key, "blog_entry_id" integer, "comment_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (61.8ms) CREATE INDEX "entry_comments_by_firm" ON "entry_comments" ("owner_firm_id") SQL (62.6ms) CREATE INDEX "entry_comments_by_owner" ON "entry_comments" ("owner_id") SQL (12.5ms) DROP TABLE "firms" SQL (72.7ms) CREATE TABLE "firms" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (9.3ms) DROP TABLE "pcheck_log_entries" SQL (86.5ms) CREATE TABLE "pcheck_log_entries" ("id" serial primary key, "request_log_entry_id" integer NOT NULL, "success" boolean NOT NULL, "model_class" character varying(100) NOT NULL, "model_id" integer, "privilege" character varying(40) NOT NULL, "user_id" integer NOT NULL, "user_name" character varying(100) NOT NULL, "created_at" timestamp, "updated_at" timestamp)  SQL (9.2ms) DROP TABLE "permissions" SQL (75.1ms) CREATE TABLE "permissions" ("id" serial primary key, "role_id" integer, "is_grant" boolean NOT NULL, "has_grant_option" boolean NOT NULL, "class_name" character varying(40) NOT NULL, "privilege" character varying(40) NOT NULL, "target_owned_by_self" boolean NOT NULL, "target_owner_id" integer, "target_owner_firm_id" integer, "target_id" integer, "target_name" character varying(100), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (63.4ms) CREATE INDEX "index_permissions_on_role_id" ON "permissions" ("role_id") SQL (16.4ms) DROP TABLE "request_log_entries" SQL (123.4ms) CREATE TABLE "request_log_entries" ("id" serial primary key, "created_at" timestamp, "updated_at" timestamp, "acting_user_id" integer, "user_of_record_id" integer, "acting_user_name" character varying(255), "user_of_record_name" character varying(255), "controller" character varying(100) NOT NULL, "action" character varying(100) NOT NULL, "http_method" character varying(50) NOT NULL, "status" character varying(100) NOT NULL, "model_class" character varying(100), "model_id" integer, "remote_ip" character varying(50))  SQL (9.1ms) DROP TABLE "role_assignments" SQL (75.4ms) CREATE TABLE "role_assignments" ("id" serial primary key, "user_id" integer NOT NULL, "role_id" integer NOT NULL, "default_user_id" integer, "default_firm_id" integer, "invalid_after" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (16.6ms) DROP TABLE "roles" SQL (68.5ms) CREATE TABLE "roles" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (63.1ms) CREATE INDEX "roles_by_firm" ON "roles" ("owner_firm_id") SQL (63.0ms) CREATE INDEX "roles_by_owner" ON "roles" ("owner_id") SQL (8.9ms) DROP TABLE "users" SQL (87.0ms) CREATE TABLE "users" ("id" serial primary key, "name" character varying(100) NOT NULL, "owner_firm_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (0.5ms) SELECT version FROM "schema_migrations" SQL (0.2ms) BEGIN Firm Load (0.7ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.7ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 Firm Load (0.5ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (1.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.6ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:04:56.204363', '2011-04-18 11:04:56.204363', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(5) SQL (2.5ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (2.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:04:56.227404', '2011-04-18 11:04:56.227404', 5, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Role Load (0.8ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.8ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.7ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:04:56.252556', '2011-04-18 11:04:56.252556', 4, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.7ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 Blog Load (0.6ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 5' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.6ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 5', '2011-04-18 11:04:56.272920', '2011-04-18 11:04:56.272920', 5, 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 Blog Load (0.6ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 6' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 6', '2011-04-18 11:04:56.288829', '2011-04-18 11:04:56.288829', 5, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 7' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 7', '2011-04-18 11:04:56.296905', '2011-04-18 11:04:56.296905', 3, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 8' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 8', '2011-04-18 11:04:56.305020', '2011-04-18 11:04:56.305020', 3, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 9' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.6ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 9', '2011-04-18 11:04:56.313006', '2011-04-18 11:04:56.313006', 4, 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 10' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 10', '2011-04-18 11:04:56.321040', '2011-04-18 11:04:56.321040', 4, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.8ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:04:56.340054', 'f', NULL, NULL, '2011-04-18 11:04:56.340054', 3, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.8ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:04:56.358293', 'f', NULL, NULL, '2011-04-18 11:04:56.358293', 3, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.7ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:04:56.369294', 't', NULL, NULL, '2011-04-18 11:04:56.369294', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.8ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:04:56.381258', 'f', 1, 'mertz family blog', '2011-04-18 11:04:56.381258', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.5ms) SELECT count(*) AS count_all FROM "permissions" WHERE ("permissions".role_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE ("permissions".role_id = 4)  SQL (2.0ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(5) SQL (2.1ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:04:56.405188', 'f', NULL, NULL, '2011-04-18 11:04:56.405188', 5, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.5ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:04:56.412652', "class_name" = 'Role' WHERE "id" = 90 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:04:56.421550' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:04:56.424080', "is_grant" = 't' WHERE "id" = 90 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:04:56.432637' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.3ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:04:56.435204', "privilege" = 'blurfl' WHERE "id" = 90 SQL (13.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:04:56.486701' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.3ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:04:56.489233', "privilege" = 'any' WHERE "id" = 90 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:04:56.495026', "invalid_after" = '2011-04-18 11:04:55.914724' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:04:56.500298', "invalid_after" = '2011-04-17 11:04:55.915079' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:04:56.505381', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:04:56.511006', "invalid_after" = '2011-04-19 11:04:55.915341' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  SQL (1.8ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.2ms) SAVEPOINT active_record_1 RoleAssignment Update (0.7ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:04:56.535106', "invalid_after" = NULL WHERE "id" = 22 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:04:56.539797' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) ROLLBACK SQL (0.3ms) SET client_min_messages TO 'ERROR' SQL (0.1ms) SET client_min_messages TO 'panic' SQL (0.1ms) SET standard_conforming_strings = on SQL (0.1ms) SET client_min_messages TO 'error' SQL (32.2ms) DROP TABLE "blog_entries" SQL (119.1ms) CREATE TABLE "blog_entries" ("id" serial primary key, "blog_id" integer NOT NULL, "entry_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (77.0ms) CREATE INDEX "blog_entries_by_firm" ON "blog_entries" ("owner_firm_id") SQL (65.9ms) CREATE INDEX "blog_entries_by_owner" ON "blog_entries" ("owner_id") SQL (21.3ms) DROP TABLE "blogs" SQL (73.4ms) CREATE TABLE "blogs" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (61.9ms) CREATE INDEX "blogs_by_firm" ON "blogs" ("owner_firm_id") SQL (72.6ms) CREATE INDEX "blogs_by_owner" ON "blogs" ("owner_id") SQL (60.5ms) CREATE UNIQUE INDEX "ix_blogs_by_name_owner_firm" ON "blogs" ("name", "owner_firm_id") SQL (21.0ms) DROP TABLE "entry_comments" SQL (128.5ms) CREATE TABLE "entry_comments" ("id" serial primary key, "blog_entry_id" integer, "comment_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (50.7ms) CREATE INDEX "entry_comments_by_firm" ON "entry_comments" ("owner_firm_id") SQL (60.7ms) CREATE INDEX "entry_comments_by_owner" ON "entry_comments" ("owner_id") SQL (8.5ms) DROP TABLE "firms" SQL (75.6ms) CREATE TABLE "firms" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (8.5ms) DROP TABLE "pcheck_log_entries" SQL (63.5ms) CREATE TABLE "pcheck_log_entries" ("id" serial primary key, "request_log_entry_id" integer NOT NULL, "success" boolean NOT NULL, "model_class" character varying(100) NOT NULL, "model_id" integer, "privilege" character varying(40) NOT NULL, "user_id" integer NOT NULL, "user_name" character varying(100) NOT NULL, "created_at" timestamp, "updated_at" timestamp)  SQL (19.2ms) DROP TABLE "permissions" SQL (63.1ms) CREATE TABLE "permissions" ("id" serial primary key, "role_id" integer, "is_grant" boolean NOT NULL, "has_grant_option" boolean NOT NULL, "class_name" character varying(40) NOT NULL, "privilege" character varying(40) NOT NULL, "target_owned_by_self" boolean NOT NULL, "target_owner_id" integer, "target_owner_firm_id" integer, "target_id" integer, "target_name" character varying(100), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (52.5ms) CREATE INDEX "index_permissions_on_role_id" ON "permissions" ("role_id") SQL (19.9ms) DROP TABLE "request_log_entries" SQL (119.4ms) CREATE TABLE "request_log_entries" ("id" serial primary key, "created_at" timestamp, "updated_at" timestamp, "acting_user_id" integer, "user_of_record_id" integer, "acting_user_name" character varying(255), "user_of_record_name" character varying(255), "controller" character varying(100) NOT NULL, "action" character varying(100) NOT NULL, "http_method" character varying(50) NOT NULL, "status" character varying(100) NOT NULL, "model_class" character varying(100), "model_id" integer, "remote_ip" character varying(50))  SQL (7.9ms) DROP TABLE "role_assignments" SQL (74.8ms) CREATE TABLE "role_assignments" ("id" serial primary key, "user_id" integer NOT NULL, "role_id" integer NOT NULL, "default_user_id" integer, "default_firm_id" integer, "invalid_after" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (20.2ms) DROP TABLE "roles" SQL (63.1ms) CREATE TABLE "roles" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (62.1ms) CREATE INDEX "roles_by_firm" ON "roles" ("owner_firm_id") SQL (61.5ms) CREATE INDEX "roles_by_owner" ON "roles" ("owner_id") SQL (8.7ms) DROP TABLE "users" SQL (75.2ms) CREATE TABLE "users" ("id" serial primary key, "name" character varying(100) NOT NULL, "owner_firm_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (7.3ms) SELECT version FROM "schema_migrations" SQL (0.1ms) BEGIN Firm Load (0.7ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.7ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 Firm Load (0.6ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (1.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.6ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:07:25.838257', '2011-04-18 11:07:25.838257', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(5) SQL (2.1ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.7ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:07:25.861068', '2011-04-18 11:07:25.861068', 5, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.1ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.6ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:07:25.882879', '2011-04-18 11:07:25.882879', 4, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.5ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.6ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 Blog Load (0.6ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 5' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 5', '2011-04-18 11:07:25.903346', '2011-04-18 11:07:25.903346', 5, 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.6ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 6' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.6ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 6', '2011-04-18 11:07:25.918779', '2011-04-18 11:07:25.918779', 5, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.6ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 7' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 7', '2011-04-18 11:07:25.927659', '2011-04-18 11:07:25.927659', 3, 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 8' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.6ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 8', '2011-04-18 11:07:25.935771', '2011-04-18 11:07:25.935771', 3, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 9' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.6ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 9', '2011-04-18 11:07:25.944090', '2011-04-18 11:07:25.944090', 4, 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 10' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 10', '2011-04-18 11:07:25.952097', '2011-04-18 11:07:25.952097', 4, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.9ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:07:25.971127', 'f', NULL, NULL, '2011-04-18 11:07:25.971127', 3, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.9ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:07:25.991220', 'f', NULL, NULL, '2011-04-18 11:07:25.991220', 3, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.9ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:07:26.002914', 't', NULL, NULL, '2011-04-18 11:07:26.002914', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.8ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:07:26.014378', 'f', 1, 'mertz family blog', '2011-04-18 11:07:26.014378', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.5ms) SELECT count(*) AS count_all FROM "permissions" WHERE ("permissions".role_id = 5)  Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions".role_id = 4)  SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(5) SQL (1.1ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:07:26.032153', 'f', NULL, NULL, '2011-04-18 11:07:26.032153', 5, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:07:26.039014', "class_name" = 'Role' WHERE "id" = 90 SQL (1.7ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:07:26.048388' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.3ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:07:26.050985', "is_grant" = 't' WHERE "id" = 90 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:07:26.059503' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:07:26.062168', "privilege" = 'blurfl' WHERE "id" = 90 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.9ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:07:26.117699' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.3ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:07:26.121049', "privilege" = 'any' WHERE "id" = 90 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.2ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:07:26.126952', "invalid_after" = '2011-04-18 11:07:25.567850' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:07:26.132528', "invalid_after" = '2011-04-17 11:07:25.568227' WHERE "id" = 22 SQL (0.6ms) RELEASE SAVEPOINT active_record_1 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:07:26.138260', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.2ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:07:26.143796', "invalid_after" = '2011-04-19 11:07:25.568480' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.5ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  SQL (1.6ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.2ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:07:27.173965', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:07:27.178017' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) ROLLBACK SQL (0.4ms) SET client_min_messages TO 'ERROR' SQL (0.1ms) SET client_min_messages TO 'panic' SQL (0.1ms) SET standard_conforming_strings = on SQL (0.1ms) SET client_min_messages TO 'error' SQL (13.5ms) DROP TABLE "blog_entries" SQL (142.3ms) CREATE TABLE "blog_entries" ("id" serial primary key, "blog_id" integer NOT NULL, "entry_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (61.1ms) CREATE INDEX "blog_entries_by_firm" ON "blog_entries" ("owner_firm_id") SQL (77.0ms) CREATE INDEX "blog_entries_by_owner" ON "blog_entries" ("owner_id") SQL (9.8ms) DROP TABLE "blogs" SQL (97.2ms) CREATE TABLE "blogs" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (86.4ms) CREATE INDEX "blogs_by_firm" ON "blogs" ("owner_firm_id") SQL (62.7ms) CREATE INDEX "blogs_by_owner" ON "blogs" ("owner_id") SQL (73.6ms) CREATE UNIQUE INDEX "ix_blogs_by_name_owner_firm" ON "blogs" ("name", "owner_firm_id") SQL (21.2ms) DROP TABLE "entry_comments" SQL (130.0ms) CREATE TABLE "entry_comments" ("id" serial primary key, "blog_entry_id" integer, "comment_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (52.3ms) CREATE INDEX "entry_comments_by_firm" ON "entry_comments" ("owner_firm_id") SQL (63.3ms) CREATE INDEX "entry_comments_by_owner" ON "entry_comments" ("owner_id") SQL (9.3ms) DROP TABLE "firms" SQL (87.4ms) CREATE TABLE "firms" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (8.7ms) DROP TABLE "pcheck_log_entries" SQL (75.7ms) CREATE TABLE "pcheck_log_entries" ("id" serial primary key, "request_log_entry_id" integer NOT NULL, "success" boolean NOT NULL, "model_class" character varying(100) NOT NULL, "model_id" integer, "privilege" character varying(40) NOT NULL, "user_id" integer NOT NULL, "user_name" character varying(100) NOT NULL, "created_at" timestamp, "updated_at" timestamp)  SQL (9.4ms) DROP TABLE "permissions" SQL (75.3ms) CREATE TABLE "permissions" ("id" serial primary key, "role_id" integer, "is_grant" boolean NOT NULL, "has_grant_option" boolean NOT NULL, "class_name" character varying(40) NOT NULL, "privilege" character varying(40) NOT NULL, "target_owned_by_self" boolean NOT NULL, "target_owner_id" integer, "target_owner_firm_id" integer, "target_id" integer, "target_name" character varying(100), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (63.4ms) CREATE INDEX "index_permissions_on_role_id" ON "permissions" ("role_id") SQL (9.7ms) DROP TABLE "request_log_entries" SQL (119.3ms) CREATE TABLE "request_log_entries" ("id" serial primary key, "created_at" timestamp, "updated_at" timestamp, "acting_user_id" integer, "user_of_record_id" integer, "acting_user_name" character varying(255), "user_of_record_name" character varying(255), "controller" character varying(100) NOT NULL, "action" character varying(100) NOT NULL, "http_method" character varying(50) NOT NULL, "status" character varying(100) NOT NULL, "model_class" character varying(100), "model_id" integer, "remote_ip" character varying(50))  SQL (11.9ms) DROP TABLE "role_assignments" SQL (86.5ms) CREATE TABLE "role_assignments" ("id" serial primary key, "user_id" integer NOT NULL, "role_id" integer NOT NULL, "default_user_id" integer, "default_firm_id" integer, "invalid_after" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (9.4ms) DROP TABLE "roles" SQL (86.5ms) CREATE TABLE "roles" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (63.4ms) CREATE INDEX "roles_by_firm" ON "roles" ("owner_firm_id") SQL (74.1ms) CREATE INDEX "roles_by_owner" ON "roles" ("owner_id") SQL (9.5ms) DROP TABLE "users" SQL (88.3ms) CREATE TABLE "users" ("id" serial primary key, "name" character varying(100) NOT NULL, "owner_firm_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (0.4ms) SELECT version FROM "schema_migrations" SQL (0.1ms) BEGIN Firm Load (0.5ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.5ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.9ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:09:06.304524', '2011-04-18 11:09:06.304524', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(5) SQL (1.4ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:09:06.319528', '2011-04-18 11:09:06.319528', 5, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.6ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.2ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:09:06.336685', '2011-04-18 11:09:06.336685', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.5ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.7ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 5' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 5', '2011-04-18 11:09:06.351613', '2011-04-18 11:09:06.351613', 5, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 6' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 6', '2011-04-18 11:09:06.361957', '2011-04-18 11:09:06.361957', 5, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 7' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 7', '2011-04-18 11:09:06.367951', '2011-04-18 11:09:06.367951', 3, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 8' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 8', '2011-04-18 11:09:06.373615', '2011-04-18 11:09:06.373615', 3, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.3ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 9' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.3ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 9', '2011-04-18 11:09:06.378951', '2011-04-18 11:09:06.378951', 4, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.3ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 10' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.3ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 10', '2011-04-18 11:09:06.383905', '2011-04-18 11:09:06.383905', 4, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Blog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.1ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:09:06.395949', 'f', NULL, NULL, '2011-04-18 11:09:06.395949', 3, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.1ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:09:06.407967', 'f', NULL, NULL, '2011-04-18 11:09:06.407967', 3, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:09:06.416115', 't', NULL, NULL, '2011-04-18 11:09:06.416115', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.1ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:09:06.423288', 'f', 1, 'mertz family blog', '2011-04-18 11:09:06.423288', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "permissions" WHERE ("permissions".role_id = 5)  Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions".role_id = 4)  SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(5) SQL (1.2ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:09:06.438012', 'f', NULL, NULL, '2011-04-18 11:09:06.438012', 5, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:09:06.444722', "class_name" = 'Role' WHERE "id" = 90 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:09:06.454317' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.3ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:09:06.456932', "is_grant" = 't' WHERE "id" = 90 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (1.0ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:09:06.465320' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:09:06.468604', "privilege" = 'blurfl' WHERE "id" = 90 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:09:06.519743' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.3ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:09:06.522340', "privilege" = 'any' WHERE "id" = 90 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.2ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:09:06.527968', "invalid_after" = '2011-04-18 11:09:05.987249' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:09:06.533005', "invalid_after" = '2011-04-17 11:09:05.993624' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:09:06.537709', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.2ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:09:06.543337', "invalid_after" = '2011-04-19 11:09:05.993947' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:09:06.560263', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:09:06.565169' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) ROLLBACK SQL (0.3ms) SET client_min_messages TO 'ERROR' SQL (0.1ms) SET client_min_messages TO 'panic' SQL (0.1ms) SET standard_conforming_strings = on SQL (0.1ms) SET client_min_messages TO 'error' SQL (13.8ms) DROP TABLE "blog_entries" SQL (128.8ms) CREATE TABLE "blog_entries" ("id" serial primary key, "blog_id" integer NOT NULL, "entry_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (47.4ms) CREATE INDEX "blog_entries_by_firm" ON "blog_entries" ("owner_firm_id") SQL (65.6ms) CREATE INDEX "blog_entries_by_owner" ON "blog_entries" ("owner_id") SQL (20.7ms) DROP TABLE "blogs" SQL (84.1ms) CREATE TABLE "blogs" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (50.9ms) CREATE INDEX "blogs_by_firm" ON "blogs" ("owner_firm_id") SQL (63.3ms) CREATE INDEX "blogs_by_owner" ON "blogs" ("owner_id") SQL (60.5ms) CREATE UNIQUE INDEX "ix_blogs_by_name_owner_firm" ON "blogs" ("name", "owner_firm_id") SQL (20.7ms) DROP TABLE "entry_comments" SQL (128.7ms) CREATE TABLE "entry_comments" ("id" serial primary key, "blog_entry_id" integer, "comment_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (76.9ms) CREATE INDEX "entry_comments_by_firm" ON "entry_comments" ("owner_firm_id") SQL (61.6ms) CREATE INDEX "entry_comments_by_owner" ON "entry_comments" ("owner_id") SQL (8.5ms) DROP TABLE "firms" SQL (75.5ms) CREATE TABLE "firms" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (7.9ms) DROP TABLE "pcheck_log_entries" SQL (163.2ms) CREATE TABLE "pcheck_log_entries" ("id" serial primary key, "request_log_entry_id" integer NOT NULL, "success" boolean NOT NULL, "model_class" character varying(100) NOT NULL, "model_id" integer, "privilege" character varying(40) NOT NULL, "user_id" integer NOT NULL, "user_name" character varying(100) NOT NULL, "created_at" timestamp, "updated_at" timestamp)  SQL (19.5ms) DROP TABLE "permissions" SQL (73.8ms) CREATE TABLE "permissions" ("id" serial primary key, "role_id" integer, "is_grant" boolean NOT NULL, "has_grant_option" boolean NOT NULL, "class_name" character varying(40) NOT NULL, "privilege" character varying(40) NOT NULL, "target_owned_by_self" boolean NOT NULL, "target_owner_id" integer, "target_owner_firm_id" integer, "target_id" integer, "target_name" character varying(100), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (62.0ms) CREATE INDEX "index_permissions_on_role_id" ON "permissions" ("role_id") SQL (19.4ms) DROP TABLE "request_log_entries" SQL (140.1ms) CREATE TABLE "request_log_entries" ("id" serial primary key, "created_at" timestamp, "updated_at" timestamp, "acting_user_id" integer, "user_of_record_id" integer, "acting_user_name" character varying(255), "user_of_record_name" character varying(255), "controller" character varying(100) NOT NULL, "action" character varying(100) NOT NULL, "http_method" character varying(50) NOT NULL, "status" character varying(100) NOT NULL, "model_class" character varying(100), "model_id" integer, "remote_ip" character varying(50))  SQL (12.0ms) DROP TABLE "role_assignments" SQL (74.8ms) CREATE TABLE "role_assignments" ("id" serial primary key, "user_id" integer NOT NULL, "role_id" integer NOT NULL, "default_user_id" integer, "default_firm_id" integer, "invalid_after" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (21.9ms) DROP TABLE "roles" SQL (83.4ms) CREATE TABLE "roles" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (52.2ms) CREATE INDEX "roles_by_firm" ON "roles" ("owner_firm_id") SQL (70.1ms) CREATE INDEX "roles_by_owner" ON "roles" ("owner_id") SQL (9.3ms) DROP TABLE "users" SQL (87.0ms) CREATE TABLE "users" ("id" serial primary key, "name" character varying(100) NOT NULL, "owner_firm_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (0.5ms) SELECT version FROM "schema_migrations" SQL (0.1ms) BEGIN Firm Load (0.5ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.8ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (1.0ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:10:00.618645', '2011-04-18 11:10:00.618645', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(5) SQL (1.4ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:10:00.634418', '2011-04-18 11:10:00.634418', 5, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.3ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.4ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:10:00.651596', '2011-04-18 11:10:00.651596', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (1.0ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.5ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 5' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 5', '2011-04-18 11:10:00.667184', '2011-04-18 11:10:00.667184', 5, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.5ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 6' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 6', '2011-04-18 11:10:00.678572', '2011-04-18 11:10:00.678572', 5, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 7' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 7', '2011-04-18 11:10:00.684230', '2011-04-18 11:10:00.684230', 3, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 8' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 8', '2011-04-18 11:10:00.690748', '2011-04-18 11:10:00.690748', 3, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.5ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 9' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 9', '2011-04-18 11:10:00.696797', '2011-04-18 11:10:00.696797', 4, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 10' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 10', '2011-04-18 11:10:00.702456', '2011-04-18 11:10:00.702456', 4, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Blog Load (0.8ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:10:00.716203', 'f', NULL, NULL, '2011-04-18 11:10:00.716203', 3, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.3ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:10:00.729288', 'f', NULL, NULL, '2011-04-18 11:10:00.729288', 3, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:10:00.737256', 't', NULL, NULL, '2011-04-18 11:10:00.737256', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:10:00.744858', 'f', 1, 'mertz family blog', '2011-04-18 11:10:00.744858', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "permissions" WHERE ("permissions".role_id = 5)  Permission Load (0.5ms) SELECT * FROM "permissions" WHERE ("permissions".role_id = 4)  SQL (1.6ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(5) SQL (1.4ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:10:00.761457', 'f', NULL, NULL, '2011-04-18 11:10:00.761457', 5, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.5ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:10:00.768307', "class_name" = 'Role' WHERE "id" = 90 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:10:00.778117' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:10:00.780903', "is_grant" = 't' WHERE "id" = 90 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:10:00.790433' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:10:00.793524', "privilege" = 'blurfl' WHERE "id" = 90 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:10:00.849788' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:10:00.852679', "privilege" = 'any' WHERE "id" = 90 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:10:00.859343', "invalid_after" = '2011-04-18 11:10:00.380821' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:10:00.865050', "invalid_after" = '2011-04-17 11:10:00.381251' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:10:00.870733', "invalid_after" = NULL WHERE "id" = 22 SQL (0.3ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.6ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:10:00.877825', "invalid_after" = '2011-04-19 11:10:00.381512' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:10:00.897157', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:10:00.901190' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) ROLLBACK SQL (0.4ms) SET client_min_messages TO 'ERROR' SQL (0.1ms) SET client_min_messages TO 'panic' SQL (0.1ms) SET standard_conforming_strings = on SQL (0.1ms) SET client_min_messages TO 'error' SQL (22.4ms) DROP TABLE "blog_entries" SQL (107.9ms) CREATE TABLE "blog_entries" ("id" serial primary key, "blog_id" integer NOT NULL, "entry_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (58.7ms) CREATE INDEX "blog_entries_by_firm" ON "blog_entries" ("owner_firm_id") SQL (76.9ms) CREATE INDEX "blog_entries_by_owner" ON "blog_entries" ("owner_id") SQL (11.7ms) DROP TABLE "blogs" SQL (73.5ms) CREATE TABLE "blogs" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (54.8ms) CREATE INDEX "blogs_by_firm" ON "blogs" ("owner_firm_id") SQL (74.0ms) CREATE INDEX "blogs_by_owner" ON "blogs" ("owner_id") SQL (71.6ms) CREATE UNIQUE INDEX "ix_blogs_by_name_owner_firm" ON "blogs" ("name", "owner_firm_id") SQL (20.9ms) DROP TABLE "entry_comments" SQL (106.5ms) CREATE TABLE "entry_comments" ("id" serial primary key, "blog_entry_id" integer, "comment_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (50.7ms) CREATE INDEX "entry_comments_by_firm" ON "entry_comments" ("owner_firm_id") SQL (72.6ms) CREATE INDEX "entry_comments_by_owner" ON "entry_comments" ("owner_id") SQL (8.6ms) DROP TABLE "firms" SQL (75.6ms) CREATE TABLE "firms" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (19.2ms) DROP TABLE "pcheck_log_entries" SQL (74.9ms) CREATE TABLE "pcheck_log_entries" ("id" serial primary key, "request_log_entry_id" integer NOT NULL, "success" boolean NOT NULL, "model_class" character varying(100) NOT NULL, "model_id" integer, "privilege" character varying(40) NOT NULL, "user_id" integer NOT NULL, "user_name" character varying(100) NOT NULL, "created_at" timestamp, "updated_at" timestamp)  SQL (19.7ms) DROP TABLE "permissions" SQL (84.8ms) CREATE TABLE "permissions" ("id" serial primary key, "role_id" integer, "is_grant" boolean NOT NULL, "has_grant_option" boolean NOT NULL, "class_name" character varying(40) NOT NULL, "privilege" character varying(40) NOT NULL, "target_owned_by_self" boolean NOT NULL, "target_owner_id" integer, "target_owner_firm_id" integer, "target_id" integer, "target_name" character varying(100), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (51.0ms) CREATE INDEX "index_permissions_on_role_id" ON "permissions" ("role_id") SQL (10.7ms) DROP TABLE "request_log_entries" SQL (129.0ms) CREATE TABLE "request_log_entries" ("id" serial primary key, "created_at" timestamp, "updated_at" timestamp, "acting_user_id" integer, "user_of_record_id" integer, "acting_user_name" character varying(255), "user_of_record_name" character varying(255), "controller" character varying(100) NOT NULL, "action" character varying(100) NOT NULL, "http_method" character varying(50) NOT NULL, "status" character varying(100) NOT NULL, "model_class" character varying(100), "model_id" integer, "remote_ip" character varying(50))  SQL (7.9ms) DROP TABLE "role_assignments" SQL (85.9ms) CREATE TABLE "role_assignments" ("id" serial primary key, "user_id" integer NOT NULL, "role_id" integer NOT NULL, "default_user_id" integer, "default_firm_id" integer, "invalid_after" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (9.1ms) DROP TABLE "roles" SQL (74.5ms) CREATE TABLE "roles" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (73.0ms) CREATE INDEX "roles_by_firm" ON "roles" ("owner_firm_id") SQL (72.5ms) CREATE INDEX "roles_by_owner" ON "roles" ("owner_id") SQL (8.7ms) DROP TABLE "users" SQL (86.3ms) CREATE TABLE "users" ("id" serial primary key, "name" character varying(100) NOT NULL, "owner_firm_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (0.6ms) SELECT version FROM "schema_migrations" SQL (0.1ms) BEGIN Firm Load (0.6ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.7ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 Firm Load (0.5ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (1.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.6ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:13:08.204951', '2011-04-18 11:13:08.204951', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(5) SQL (2.0ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.7ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:13:08.226971', '2011-04-18 11:13:08.226971', 5, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.8ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.7ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:13:08.252430', '2011-04-18 11:13:08.252430', 4, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.7ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 Blog Load (0.6ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 5' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.6ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 5', '2011-04-18 11:13:08.273073', '2011-04-18 11:13:08.273073', 5, 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 Blog Load (0.6ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 6' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 6', '2011-04-18 11:13:08.288485', '2011-04-18 11:13:08.288485', 5, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 7' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 7', '2011-04-18 11:13:08.296366', '2011-04-18 11:13:08.296366', 3, 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 8' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 8', '2011-04-18 11:13:08.304795', '2011-04-18 11:13:08.304795', 3, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 9' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.6ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 9', '2011-04-18 11:13:08.313078', '2011-04-18 11:13:08.313078', 4, 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 10' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 10', '2011-04-18 11:13:08.321296', '2011-04-18 11:13:08.321296', 4, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.2ms) SAVEPOINT active_record_1 SQL (2.0ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:13:08.340316', 'f', NULL, NULL, '2011-04-18 11:13:08.340316', 3, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.8ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:13:08.358998', 'f', NULL, NULL, '2011-04-18 11:13:08.358998', 3, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.9ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:13:08.370705', 't', NULL, NULL, '2011-04-18 11:13:08.370705', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.8ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:13:08.382164', 'f', 1, 'mertz family blog', '2011-04-18 11:13:08.382164', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.5ms) SELECT count(*) AS count_all FROM "permissions" WHERE ("permissions".role_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE ("permissions".role_id = 4)  SQL (2.0ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(5) SQL (1.9ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:13:08.405610', 'f', NULL, NULL, '2011-04-18 11:13:08.405610', 5, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.5ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:13:08.412536', "class_name" = 'Role' WHERE "id" = 90 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:13:08.421574' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.3ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:13:08.424045', "is_grant" = 't' WHERE "id" = 90 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:13:08.432869' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.3ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:13:08.435304', "privilege" = 'blurfl' WHERE "id" = 90 SQL (13.9ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:13:08.487330' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  Permission Update (0.3ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:13:08.491892', "privilege" = 'any' WHERE "id" = 90 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:13:08.497486', "invalid_after" = '2011-04-18 11:13:07.978103' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:13:08.502761', "invalid_after" = '2011-04-17 11:13:07.978443' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:13:08.507867', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.2ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:13:08.513828', "invalid_after" = '2011-04-19 11:13:07.978710' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:13:08.532369', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:13:08.536079' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) ROLLBACK SQL (0.3ms) SET client_min_messages TO 'ERROR' SQL (0.1ms) SET client_min_messages TO 'panic' SQL (0.1ms) SET standard_conforming_strings = on SQL (0.1ms) SET client_min_messages TO 'error' SQL (28.3ms) DROP TABLE "blog_entries" SQL (130.2ms) CREATE TABLE "blog_entries" ("id" serial primary key, "blog_id" integer NOT NULL, "entry_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (65.8ms) CREATE INDEX "blog_entries_by_firm" ON "blog_entries" ("owner_firm_id") SQL (65.9ms) CREATE INDEX "blog_entries_by_owner" ON "blog_entries" ("owner_id") SQL (19.6ms) DROP TABLE "blogs" SQL (86.3ms) CREATE TABLE "blogs" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (62.2ms) CREATE INDEX "blogs_by_firm" ON "blogs" ("owner_firm_id") SQL (72.3ms) CREATE INDEX "blogs_by_owner" ON "blogs" ("owner_id") SQL (71.2ms) CREATE UNIQUE INDEX "ix_blogs_by_name_owner_firm" ON "blogs" ("name", "owner_firm_id") SQL (11.8ms) DROP TABLE "entry_comments" SQL (128.3ms) CREATE TABLE "entry_comments" ("id" serial primary key, "blog_entry_id" integer, "comment_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (61.8ms) CREATE INDEX "entry_comments_by_firm" ON "entry_comments" ("owner_firm_id") SQL (72.5ms) CREATE INDEX "entry_comments_by_owner" ON "entry_comments" ("owner_id") SQL (8.5ms) DROP TABLE "firms" SQL (75.7ms) CREATE TABLE "firms" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (7.9ms) DROP TABLE "pcheck_log_entries" SQL (64.0ms) CREATE TABLE "pcheck_log_entries" ("id" serial primary key, "request_log_entry_id" integer NOT NULL, "success" boolean NOT NULL, "model_class" character varying(100) NOT NULL, "model_id" integer, "privilege" character varying(40) NOT NULL, "user_id" integer NOT NULL, "user_name" character varying(100) NOT NULL, "created_at" timestamp, "updated_at" timestamp)  SQL (19.6ms) DROP TABLE "permissions" SQL (74.1ms) CREATE TABLE "permissions" ("id" serial primary key, "role_id" integer, "is_grant" boolean NOT NULL, "has_grant_option" boolean NOT NULL, "class_name" character varying(40) NOT NULL, "privilege" character varying(40) NOT NULL, "target_owned_by_self" boolean NOT NULL, "target_owner_id" integer, "target_owner_firm_id" integer, "target_id" integer, "target_name" character varying(100), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (50.8ms) CREATE INDEX "index_permissions_on_role_id" ON "permissions" ("role_id") SQL (19.8ms) DROP TABLE "request_log_entries" SQL (97.3ms) CREATE TABLE "request_log_entries" ("id" serial primary key, "created_at" timestamp, "updated_at" timestamp, "acting_user_id" integer, "user_of_record_id" integer, "acting_user_name" character varying(255), "user_of_record_name" character varying(255), "controller" character varying(100) NOT NULL, "action" character varying(100) NOT NULL, "http_method" character varying(50) NOT NULL, "status" character varying(100) NOT NULL, "model_class" character varying(100), "model_id" integer, "remote_ip" character varying(50))  SQL (8.3ms) DROP TABLE "role_assignments" SQL (63.6ms) CREATE TABLE "role_assignments" ("id" serial primary key, "user_id" integer NOT NULL, "role_id" integer NOT NULL, "default_user_id" integer, "default_firm_id" integer, "invalid_after" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (19.7ms) DROP TABLE "roles" SQL (63.0ms) CREATE TABLE "roles" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (50.9ms) CREATE INDEX "roles_by_firm" ON "roles" ("owner_firm_id") SQL (61.5ms) CREATE INDEX "roles_by_owner" ON "roles" ("owner_id") SQL (8.5ms) DROP TABLE "users" SQL (64.3ms) CREATE TABLE "users" ("id" serial primary key, "name" character varying(100) NOT NULL, "owner_firm_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (7.4ms) SELECT version FROM "schema_migrations" SQL (0.1ms) BEGIN Firm Load (0.6ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.8ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 Firm Load (0.6ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (1.5ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.6ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:14:04.564712', '2011-04-18 11:14:04.564712', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(5) SQL (2.0ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.8ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:14:04.587631', '2011-04-18 11:14:04.587631', 5, 5, NULL, NULL) RETURNING "id" SQL (0.3ms) RELEASE SAVEPOINT active_record_1 Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.8ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.6ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:14:04.612907', '2011-04-18 11:14:04.612907', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 5' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.3ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 5', '2011-04-18 11:14:04.626050', '2011-04-18 11:14:04.626050', 5, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.3ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 6' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.3ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 6', '2011-04-18 11:14:04.635448', '2011-04-18 11:14:04.635448', 5, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 7' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.3ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 7', '2011-04-18 11:14:04.640684', '2011-04-18 11:14:04.640684', 3, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.3ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 8' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 8', '2011-04-18 11:14:04.646304', '2011-04-18 11:14:04.646304', 3, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.3ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 9' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 9', '2011-04-18 11:14:04.652831', '2011-04-18 11:14:04.652831', 4, 3) RETURNING "id" SQL (0.4ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 10' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.6ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 10', '2011-04-18 11:14:04.661104', '2011-04-18 11:14:04.661104', 4, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.9ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:14:04.681171', 'f', NULL, NULL, '2011-04-18 11:14:04.681171', 3, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.9ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:14:04.699683', 'f', NULL, NULL, '2011-04-18 11:14:04.699683', 3, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.9ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (1.1ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:14:04.711866', 't', NULL, NULL, '2011-04-18 11:14:04.711866', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (2.7ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:14:04.724479', 'f', 1, 'mertz family blog', '2011-04-18 11:14:04.724479', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.6ms) SELECT count(*) AS count_all FROM "permissions" WHERE ("permissions".role_id = 5)  Permission Load (0.5ms) SELECT * FROM "permissions" WHERE ("permissions".role_id = 4)  SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(5) SQL (1.3ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:14:04.742503', 'f', NULL, NULL, '2011-04-18 11:14:04.742503', 5, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.3ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.5ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:14:04.750457', "class_name" = 'Role' WHERE "id" = 90 SQL (1.4ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:14:04.760435' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:14:04.763169', "is_grant" = 't' WHERE "id" = 90 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:14:04.773302' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:14:04.776372', "privilege" = 'blurfl' WHERE "id" = 90 SQL (14.8ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:14:04.834491' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:14:04.842740', "privilege" = 'any' WHERE "id" = 90 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (1.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:14:04.851046', "invalid_after" = '2011-04-18 11:14:04.358254' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.6ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:14:04.856461', "invalid_after" = '2011-04-17 11:14:04.358618' WHERE "id" = 22 SQL (0.3ms) RELEASE SAVEPOINT active_record_1 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:14:04.862769', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.6ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:14:04.869926', "invalid_after" = '2011-04-19 11:14:04.358864' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:14:04.888899', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:14:04.893014' WHERE "id" = 90 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) ROLLBACK SQL (0.3ms) SET client_min_messages TO 'ERROR' SQL (0.1ms) SET client_min_messages TO 'panic' SQL (0.1ms) SET standard_conforming_strings = on SQL (0.1ms) SET client_min_messages TO 'error' SQL (18.0ms) DROP TABLE "blog_entries" SQL (140.8ms) CREATE TABLE "blog_entries" ("id" serial primary key, "blog_id" integer NOT NULL, "entry_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (58.7ms) CREATE INDEX "blog_entries_by_firm" ON "blog_entries" ("owner_firm_id") SQL (70.7ms) CREATE INDEX "blog_entries_by_owner" ON "blog_entries" ("owner_id") SQL (21.1ms) DROP TABLE "blogs" SQL (62.5ms) CREATE TABLE "blogs" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (54.9ms) CREATE INDEX "blogs_by_firm" ON "blogs" ("owner_firm_id") SQL (83.7ms) CREATE INDEX "blogs_by_owner" ON "blogs" ("owner_id") SQL (60.5ms) CREATE UNIQUE INDEX "ix_blogs_by_name_owner_firm" ON "blogs" ("name", "owner_firm_id") SQL (22.5ms) DROP TABLE "entry_comments" SQL (105.3ms) CREATE TABLE "entry_comments" ("id" serial primary key, "blog_entry_id" integer, "comment_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (50.6ms) CREATE INDEX "entry_comments_by_firm" ON "entry_comments" ("owner_firm_id") SQL (63.1ms) CREATE INDEX "entry_comments_by_owner" ON "entry_comments" ("owner_id") SQL (8.7ms) DROP TABLE "firms" SQL (75.6ms) CREATE TABLE "firms" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (8.1ms) DROP TABLE "pcheck_log_entries" SQL (75.2ms) CREATE TABLE "pcheck_log_entries" ("id" serial primary key, "request_log_entry_id" integer NOT NULL, "success" boolean NOT NULL, "model_class" character varying(100) NOT NULL, "model_id" integer, "privilege" character varying(40) NOT NULL, "user_id" integer NOT NULL, "user_name" character varying(100) NOT NULL, "created_at" timestamp, "updated_at" timestamp)  SQL (8.6ms) DROP TABLE "permissions" SQL (75.2ms) CREATE TABLE "permissions" ("id" serial primary key, "role_id" integer, "is_grant" boolean NOT NULL, "has_grant_option" boolean NOT NULL, "class_name" character varying(40) NOT NULL, "privilege" character varying(40) NOT NULL, "target_owned_by_self" boolean NOT NULL, "target_owner_id" integer, "target_owner_firm_id" integer, "target_id" integer, "target_name" character varying(100), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (52.0ms) CREATE INDEX "index_permissions_on_role_id" ON "permissions" ("role_id") SQL (17.5ms) DROP TABLE "request_log_entries" SQL (118.9ms) CREATE TABLE "request_log_entries" ("id" serial primary key, "created_at" timestamp, "updated_at" timestamp, "acting_user_id" integer, "user_of_record_id" integer, "acting_user_name" character varying(255), "user_of_record_name" character varying(255), "controller" character varying(100) NOT NULL, "action" character varying(100) NOT NULL, "http_method" character varying(50) NOT NULL, "status" character varying(100) NOT NULL, "model_class" character varying(100), "model_id" integer, "remote_ip" character varying(50))  SQL (8.5ms) DROP TABLE "role_assignments" SQL (97.7ms) CREATE TABLE "role_assignments" ("id" serial primary key, "user_id" integer NOT NULL, "role_id" integer NOT NULL, "default_user_id" integer, "default_firm_id" integer, "invalid_after" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (16.0ms) DROP TABLE "roles" SQL (79.8ms) CREATE TABLE "roles" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (74.2ms) CREATE INDEX "roles_by_firm" ON "roles" ("owner_firm_id") SQL (73.7ms) CREATE INDEX "roles_by_owner" ON "roles" ("owner_id") SQL (9.2ms) DROP TABLE "users" SQL (98.0ms) CREATE TABLE "users" ("id" serial primary key, "name" character varying(100) NOT NULL, "owner_firm_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (0.6ms) SELECT version FROM "schema_migrations" SQL (0.2ms) BEGIN Firm Load (0.6ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.7ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.7ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.9ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.4ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:14:26.692980', '2011-04-18 11:14:26.692980', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(5) SQL (1.3ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:14:26.708278', '2011-04-18 11:14:26.708278', 5, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.4ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.3ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:14:26.726288', '2011-04-18 11:14:26.726288', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 5' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 5', '2011-04-18 11:14:26.741773', '2011-04-18 11:14:26.741773', 5, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 6' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 6', '2011-04-18 11:14:26.752455', '2011-04-18 11:14:26.752455', 5, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 7' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 7', '2011-04-18 11:14:26.758853', '2011-04-18 11:14:26.758853', 3, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 8' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 8', '2011-04-18 11:14:26.764562', '2011-04-18 11:14:26.764562', 3, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 9' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 9', '2011-04-18 11:14:26.770435', '2011-04-18 11:14:26.770435', 4, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 10' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 10', '2011-04-18 11:14:26.776820', '2011-04-18 11:14:26.776820', 4, 2) RETURNING "id" SQL (0.3ms) RELEASE SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.9ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:14:26.790413', 'f', NULL, NULL, '2011-04-18 11:14:26.790413', 3, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.5ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:14:26.803872', 'f', NULL, NULL, '2011-04-18 11:14:26.803872', 3, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.3ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:14:26.812186', 't', NULL, NULL, '2011-04-18 11:14:26.812186', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:14:26.820762', 'f', 1, 'mertz family blog', '2011-04-18 11:14:26.820762', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "permissions" WHERE ("permissions".role_id = 5)  Permission Load (0.5ms) SELECT * FROM "permissions" WHERE ("permissions".role_id = 4)  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(5) SQL (1.2ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (3.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:14:26.848114', 'f', NULL, NULL, '2011-04-18 11:14:26.848114', 5, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.5ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:14:26.870700', "class_name" = 'Role' WHERE "id" = 90 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (1.1ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:14:26.880645' WHERE "id" = 90 SQL (0.4ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.9ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:14:26.887559', "is_grant" = 't' WHERE "id" = 90 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:14:26.898094' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:14:26.901153', "privilege" = 'blurfl' WHERE "id" = 90 SQL (13.7ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:14:26.961001' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  Permission Update (0.5ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:14:26.969691', "privilege" = 'any' WHERE "id" = 90 RoleAssignment Load (0.7ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:14:26.988543', "invalid_after" = '2011-04-18 11:14:26.417368' WHERE "id" = 22 SQL (0.8ms) RELEASE SAVEPOINT active_record_1 SQL (2.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.3ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:14:27.003489', "invalid_after" = '2011-04-17 11:14:26.417730' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (4.8ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:14:27.008978', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.6ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:14:27.024273', "invalid_after" = '2011-04-19 11:14:26.417977' WHERE "id" = 22 SQL (2.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 RoleAssignment Update (0.5ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:14:27.069595', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (4.4ms) UPDATE "permissions" SET "updated_at" = '2011-04-18 11:14:27.073501' WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) ROLLBACK SQL (0.3ms) SET client_min_messages TO 'ERROR' SQL (0.1ms) SET client_min_messages TO 'panic' SQL (0.1ms) SET standard_conforming_strings = on SQL (0.1ms) SET client_min_messages TO 'error' SQL (12.5ms) DROP TABLE "blog_entries" SQL (108.1ms) CREATE TABLE "blog_entries" ("id" serial primary key, "blog_id" integer NOT NULL, "entry_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (58.6ms) CREATE INDEX "blog_entries_by_firm" ON "blog_entries" ("owner_firm_id") SQL (65.9ms) CREATE INDEX "blog_entries_by_owner" ON "blog_entries" ("owner_id") SQL (20.8ms) DROP TABLE "blogs" SQL (73.8ms) CREATE TABLE "blogs" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (62.1ms) CREATE INDEX "blogs_by_firm" ON "blogs" ("owner_firm_id") SQL (85.1ms) CREATE INDEX "blogs_by_owner" ON "blogs" ("owner_id") SQL (82.8ms) CREATE UNIQUE INDEX "ix_blogs_by_name_owner_firm" ON "blogs" ("name", "owner_firm_id") SQL (20.5ms) DROP TABLE "entry_comments" SQL (107.5ms) CREATE TABLE "entry_comments" ("id" serial primary key, "blog_entry_id" integer, "comment_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (61.4ms) CREATE INDEX "entry_comments_by_firm" ON "entry_comments" ("owner_firm_id") SQL (74.3ms) CREATE INDEX "entry_comments_by_owner" ON "entry_comments" ("owner_id") SQL (8.7ms) DROP TABLE "firms" SQL (86.7ms) CREATE TABLE "firms" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (8.0ms) DROP TABLE "pcheck_log_entries" SQL (86.0ms) CREATE TABLE "pcheck_log_entries" ("id" serial primary key, "request_log_entry_id" integer NOT NULL, "success" boolean NOT NULL, "model_class" character varying(100) NOT NULL, "model_id" integer, "privilege" character varying(40) NOT NULL, "user_id" integer NOT NULL, "user_name" character varying(100) NOT NULL, "created_at" timestamp, "updated_at" timestamp)  SQL (19.5ms) DROP TABLE "permissions" SQL (74.1ms) CREATE TABLE "permissions" ("id" serial primary key, "role_id" integer, "is_grant" boolean NOT NULL, "has_grant_option" boolean NOT NULL, "class_name" character varying(40) NOT NULL, "privilege" character varying(40) NOT NULL, "target_owned_by_self" boolean NOT NULL, "target_owner_id" integer, "target_owner_firm_id" integer, "target_id" integer, "target_name" character varying(100), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (62.0ms) CREATE INDEX "index_permissions_on_role_id" ON "permissions" ("role_id") SQL (19.8ms) DROP TABLE "request_log_entries" SQL (117.7ms) CREATE TABLE "request_log_entries" ("id" serial primary key, "created_at" timestamp, "updated_at" timestamp, "acting_user_id" integer, "user_of_record_id" integer, "acting_user_name" character varying(255), "user_of_record_name" character varying(255), "controller" character varying(100) NOT NULL, "action" character varying(100) NOT NULL, "http_method" character varying(50) NOT NULL, "status" character varying(100) NOT NULL, "model_class" character varying(100), "model_id" integer, "remote_ip" character varying(50))  SQL (19.0ms) DROP TABLE "role_assignments" SQL (85.8ms) CREATE TABLE "role_assignments" ("id" serial primary key, "user_id" integer NOT NULL, "role_id" integer NOT NULL, "default_user_id" integer, "default_firm_id" integer, "invalid_after" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (20.2ms) DROP TABLE "roles" SQL (63.3ms) CREATE TABLE "roles" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (51.1ms) CREATE INDEX "roles_by_firm" ON "roles" ("owner_firm_id") SQL (72.3ms) CREATE INDEX "roles_by_owner" ON "roles" ("owner_id") SQL (8.7ms) DROP TABLE "users" SQL (86.3ms) CREATE TABLE "users" ("id" serial primary key, "name" character varying(100) NOT NULL, "owner_firm_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (0.5ms) SELECT version FROM "schema_migrations" SQL (0.1ms) BEGIN Firm Load (0.5ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.5ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.9ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.3ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:17:29.126789', '2011-04-18 11:17:29.126789', 6, 2) RETURNING "id" SQL (0.5ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(5) SQL (1.4ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.5ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:17:29.143488', '2011-04-18 11:17:29.143488', 5, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.4ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:17:29.163455', '2011-04-18 11:17:29.163455', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Firm Load (0.5ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.5ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 5' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 5', '2011-04-18 11:17:29.177904', '2011-04-18 11:17:29.177904', 5, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 6' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.7ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 6', '2011-04-18 11:17:29.189256', '2011-04-18 11:17:29.189256', 5, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 7' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 7', '2011-04-18 11:17:29.195346', '2011-04-18 11:17:29.195346', 3, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 8' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.6ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 8', '2011-04-18 11:17:29.201540', '2011-04-18 11:17:29.201540', 3, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 9' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.6ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 9', '2011-04-18 11:17:29.207457', '2011-04-18 11:17:29.207457', 4, 3) RETURNING "id" SQL (0.6ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 10' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 10', '2011-04-18 11:17:29.214104', '2011-04-18 11:17:29.214104', 4, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:29.227884', 'f', NULL, NULL, '2011-04-18 11:17:29.227884', 3, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SAVEPOINT active_record_1 SQL (1.3ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:29.241934', 'f', NULL, NULL, '2011-04-18 11:17:29.241934', 3, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.5ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:29.250202', 't', NULL, NULL, '2011-04-18 11:17:29.250202', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.5ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:29.258401', 'f', 1, 'mertz family blog', '2011-04-18 11:17:29.258401', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.5ms) SELECT count(*) AS count_all FROM "permissions" WHERE ("permissions".role_id = 5)  Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions".role_id = 4)  SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(5) SQL (1.2ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:29.283375', 'f', NULL, NULL, '2011-04-18 11:17:29.283375', 5, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (5.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (2.1ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:29.295656', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.283375', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 90 SQL (2.7ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (6.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:29.314774', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.283375', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 90 SQL (1.0ms) RELEASE SAVEPOINT active_record_1 Permission Update (2.0ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:29.318806', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.283375', "target_name" = NULL, "is_grant" = 't', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 90 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:29.335891', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.283375', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:29.339314', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.283375', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 90 SQL (1.6ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:29.397584', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.283375', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:29.404013', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.283375', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:29.408722', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.283375', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'any', "target_owner_firm_id" = NULL WHERE "id" = 90 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (2.0ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (1.9ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.422636', "invalid_after" = '2011-04-18 11:17:28.893034' WHERE "id" = 22 SQL (0.6ms) RELEASE SAVEPOINT active_record_1 SQL (2.4ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (3.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.436289', "invalid_after" = '2011-04-17 11:17:28.893388' WHERE "id" = 22 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (2.6ms) SAVEPOINT active_record_1 RoleAssignment Update (1.1ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.447803', "invalid_after" = NULL WHERE "id" = 22 SQL (0.7ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (1.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (1.3ms) SAVEPOINT active_record_1 User Load (1.6ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (6.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.5ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.465306', "invalid_after" = '2011-04-19 11:17:28.893639' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (7.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (2.6ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (2.5ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.7ms) SELECT * FROM "blogs"  SQL (4.1ms) SAVEPOINT active_record_1 RoleAssignment Update (4.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.527736', "invalid_after" = '2011-04-20 11:17:28.893889' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (8.0ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (3.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.9ms) SELECT * FROM "blogs"  SQL (4.8ms) SAVEPOINT active_record_1 RoleAssignment Update (2.1ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.590632', "invalid_after" = NULL WHERE "id" = 22 SQL (2.6ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.4ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (3.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.1ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:29.661204', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.283375', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.676663', "invalid_after" = '2011-04-18 11:17:28.893034' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (5.2ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.683618', "invalid_after" = '2011-04-17 11:17:28.893388' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.5ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.694034', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.5ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.704123', "invalid_after" = '2011-04-19 11:17:28.893639' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.5ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (5.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 RoleAssignment Update (0.9ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.742071', "invalid_after" = '2011-04-20 11:17:28.893889' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  Permission Load (1.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.7ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.778255', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 90)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.4ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(5) SQL (1.4ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:29.830283', 'f', NULL, NULL, '2011-04-18 11:17:29.830283', 5, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:29.842062', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.830283', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 91 SQL (1.4ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:29.851815', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.830283', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 91 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:29.854853', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.830283', "target_name" = NULL, "is_grant" = 't', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 91 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:29.864212', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.830283', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 91 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:29.867173', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.830283', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = 3 WHERE "id" = 91 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:29.878312', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.830283', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 91 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 91)  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:29.883687', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.830283', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 91 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 91)  Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:29.888490', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.830283', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'any', "target_owner_firm_id" = 3 WHERE "id" = 91 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.894649', "invalid_after" = '2011-04-18 11:17:28.893034' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.904791', "invalid_after" = '2011-04-17 11:17:28.893388' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.4ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.910136', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.916191', "invalid_after" = '2011-04-19 11:17:28.893639' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 91)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (2.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.6ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.5ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.948570', "invalid_after" = '2011-04-20 11:17:28.893889' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 91)  Permission Load (4.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.4ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:29.983606', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 91)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.023307', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:29.830283', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 91 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.029762', "invalid_after" = '2011-04-18 11:17:28.893034' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.035728', "invalid_after" = '2011-04-17 11:17:28.893388' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.7ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.7ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.041319', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.8ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.049847', "invalid_after" = '2011-04-19 11:17:28.893639' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 91)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.084770', "invalid_after" = '2011-04-20 11:17:28.893889' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 91)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.116150', "invalid_after" = NULL WHERE "id" = 22 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 91)  Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.7ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 91 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(5) SQL (1.2ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:30.167322', 't', NULL, NULL, '2011-04-18 11:17:30.167322', 5, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.179266', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:17:30.167322', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 92 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.8ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.189351', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:17:30.167322', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 92 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.192805', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:17:30.167322', "target_name" = NULL, "is_grant" = 't', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 92 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.201827', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:17:30.167322', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 92 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.204724', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:17:30.167322', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 92 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.213998', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:17:30.167322', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 92 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 92)  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.219624', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:17:30.167322', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 92 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 92)  Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.223930', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:17:30.167322', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'any', "target_owner_firm_id" = NULL WHERE "id" = 92 RoleAssignment Load (2.5ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.296434', "invalid_after" = '2011-04-18 11:17:28.893034' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.302402', "invalid_after" = '2011-04-17 11:17:28.893388' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.308559', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.7ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.315622', "invalid_after" = '2011-04-19 11:17:28.893639' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 92)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (4.1ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.348293', "invalid_after" = '2011-04-20 11:17:28.893889' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 92)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.6ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.375573', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 92)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.7ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (2.6ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.404538', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:17:30.167322', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 92 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.413587', "invalid_after" = '2011-04-18 11:17:28.893034' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.4ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.418964', "invalid_after" = '2011-04-17 11:17:28.893388' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.423869', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.430427', "invalid_after" = '2011-04-19 11:17:28.893639' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 92)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.458014', "invalid_after" = '2011-04-20 11:17:28.893889' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 92)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (2.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.485265', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 92)  Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.4ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 92 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(5) SQL (1.3ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:30.528002', 'f', 1, 'mertz family blog', '2011-04-18 11:17:30.528002', 5, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.535147', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:30.528002', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 93 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.545674', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:30.528002', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 93 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.549139', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:30.528002', "target_name" = 'mertz family blog', "is_grant" = 't', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 93 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.558572', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:30.528002', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 93 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.561392', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:30.528002', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 93 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.570626', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:30.528002', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 93 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 93)  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.576086', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:30.528002', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 93 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 93)  Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.580132', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:30.528002', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'any', "target_owner_firm_id" = NULL WHERE "id" = 93 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.588114', "invalid_after" = '2011-04-18 11:17:28.893034' WHERE "id" = 22 SQL (0.4ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.3ms) SAVEPOINT active_record_1 RoleAssignment Update (0.6ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.594167', "invalid_after" = '2011-04-17 11:17:28.893388' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.599387', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.7ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.605733', "invalid_after" = '2011-04-19 11:17:28.893639' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 93)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.3ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.634862', "invalid_after" = '2011-04-20 11:17:28.893889' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 93)  Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (2.0ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.664798', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 93)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.5ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 5, "updated_at" = '2011-04-18 11:17:30.695484', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:17:30.528002', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 93 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.701270', "invalid_after" = '2011-04-18 11:17:28.893034' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.8ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.707193', "invalid_after" = '2011-04-17 11:17:28.893388' WHERE "id" = 22 SQL (0.3ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.712291', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 5)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 5)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.718370', "invalid_after" = '2011-04-19 11:17:28.893639' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 93)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.747428', "invalid_after" = '2011-04-20 11:17:28.893889' WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 93)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.4ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:17:30.777127', "invalid_after" = NULL WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE ("permissions"."id" = 93)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.6ms) DELETE FROM "permissions" WHERE "id" = 93 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(5) SQL (1.5ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:30.816138', 'f', NULL, NULL, '2011-04-18 11:17:30.816138', 5, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(5) SQL (1.2ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:30.823534', 'f', NULL, NULL, '2011-04-18 11:17:30.823534', 5, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.5ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.5ms) SELECT * FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.4ms) DELETE FROM "permissions" WHERE "id" = 94 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 95 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(5) SQL (1.2ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:30.872056', 'f', NULL, NULL, '2011-04-18 11:17:30.872056', 5, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(5) SQL (1.1ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:30.879304', 't', NULL, NULL, '2011-04-18 11:17:30.879304', 5, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 96 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.5ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 97 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(5) SQL (1.2ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:30.920421', 'f', NULL, NULL, '2011-04-18 11:17:30.920421', 5, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(5) SQL (1.3ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:30.928236', 'f', 1, 'mertz family blog', '2011-04-18 11:17:30.928236', 5, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.5ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.6ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.4ms) DELETE FROM "permissions" WHERE "id" = 98 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 99 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(5) SQL (1.2ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:30.978101', 'f', NULL, NULL, '2011-04-18 11:17:30.978101', 5, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(5) SQL (1.8ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:31.045244', 'f', NULL, NULL, '2011-04-18 11:17:31.045244', 5, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.4ms) DELETE FROM "permissions" WHERE "id" = 100 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 101 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(5) SQL (1.2ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:31.095309', 'f', NULL, NULL, '2011-04-18 11:17:31.095309', 5, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(5) SQL (1.2ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:31.103129', 't', NULL, NULL, '2011-04-18 11:17:31.103129', 5, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.6ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.6ms) DELETE FROM "permissions" WHERE "id" = 102 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 103 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(5) SQL (1.5ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:31.147906', 'f', NULL, NULL, '2011-04-18 11:17:31.147906', 5, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(5) SQL (1.5ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:31.156034', 'f', 1, 'mertz family blog', '2011-04-18 11:17:31.156034', 5, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.4ms) DELETE FROM "permissions" WHERE "id" = 104 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 105 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(5) SQL (1.3ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:31.204795', 't', NULL, NULL, '2011-04-18 11:17:31.204795', 5, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(5) SQL (1.2ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:31.212558', 'f', NULL, NULL, '2011-04-18 11:17:31.212558', 5, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.4ms) DELETE FROM "permissions" WHERE "id" = 106 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.4ms) DELETE FROM "permissions" WHERE "id" = 107 SQL (0.3ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(5) SQL (1.5ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:31.257194', 't', NULL, NULL, '2011-04-18 11:17:31.257194', 5, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(5) SQL (1.7ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:31.264937', 'f', NULL, NULL, '2011-04-18 11:17:31.264937', 5, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.5ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.4ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 108 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.2ms) DELETE FROM "permissions" WHERE "id" = 109 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(5) SQL (1.3ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:31.305104', 't', NULL, NULL, '2011-04-18 11:17:31.305104', 5, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(5) SQL (1.2ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:31.312415', 'f', 1, 'mertz family blog', '2011-04-18 11:17:31.312415', 5, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.5ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.4ms) DELETE FROM "permissions" WHERE "id" = 110 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.2ms) DELETE FROM "permissions" WHERE "id" = 111 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(5) SQL (1.2ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:31.351698', 'f', 1, 'mertz family blog', '2011-04-18 11:17:31.351698', 5, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(5) SQL (1.1ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:31.358164', 'f', NULL, NULL, '2011-04-18 11:17:31.358164', 5, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 112 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.2ms) DELETE FROM "permissions" WHERE "id" = 113 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(5) SQL (1.1ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:31.401409', 'f', 1, 'mertz family blog', '2011-04-18 11:17:31.401409', 5, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(5) SQL (1.1ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:31.407914', 'f', NULL, NULL, '2011-04-18 11:17:31.407914', 5, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 114 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.2ms) DELETE FROM "permissions" WHERE "id" = 115 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(5) SQL (1.3ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:31.450559', 'f', 1, 'mertz family blog', '2011-04-18 11:17:31.450559', 5, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(5) SQL (1.1ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:17:31.457048', 't', NULL, NULL, '2011-04-18 11:17:31.457048', 5, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.1ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 116 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(5) Permission Destroy (0.2ms) DELETE FROM "permissions" WHERE "id" = 117 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(5) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 5 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 23 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) ROLLBACK SQL (0.3ms) SET client_min_messages TO 'ERROR' SQL (0.2ms) SET client_min_messages TO 'panic' SQL (0.1ms) SET standard_conforming_strings = on SQL (0.1ms) SET client_min_messages TO 'error' SQL (99.3ms) DROP TABLE "blog_entries" SQL (118.8ms) CREATE TABLE "blog_entries" ("id" serial primary key, "blog_id" integer NOT NULL, "entry_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (69.6ms) CREATE INDEX "blog_entries_by_firm" ON "blog_entries" ("owner_firm_id") SQL (65.9ms) CREATE INDEX "blog_entries_by_owner" ON "blog_entries" ("owner_id") SQL (20.7ms) DROP TABLE "blogs" SQL (73.9ms) CREATE TABLE "blogs" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (66.0ms) CREATE INDEX "blogs_by_firm" ON "blogs" ("owner_firm_id") SQL (50.3ms) CREATE INDEX "blogs_by_owner" ON "blogs" ("owner_id") SQL (50.5ms) CREATE UNIQUE INDEX "ix_blogs_by_name_owner_firm" ON "blogs" ("name", "owner_firm_id") SQL (11.4ms) DROP TABLE "entry_comments" SQL (106.3ms) CREATE TABLE "entry_comments" ("id" serial primary key, "blog_entry_id" integer, "comment_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (50.8ms) CREATE INDEX "entry_comments_by_firm" ON "entry_comments" ("owner_firm_id") SQL (50.4ms) CREATE INDEX "entry_comments_by_owner" ON "entry_comments" ("owner_id") SQL (8.7ms) DROP TABLE "firms" SQL (86.7ms) CREATE TABLE "firms" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (8.2ms) DROP TABLE "pcheck_log_entries" SQL (75.0ms) CREATE TABLE "pcheck_log_entries" ("id" serial primary key, "request_log_entry_id" integer NOT NULL, "success" boolean NOT NULL, "model_class" character varying(100) NOT NULL, "model_id" integer, "privilege" character varying(40) NOT NULL, "user_id" integer NOT NULL, "user_name" character varying(100) NOT NULL, "created_at" timestamp, "updated_at" timestamp)  SQL (19.9ms) DROP TABLE "permissions" SQL (84.8ms) CREATE TABLE "permissions" ("id" serial primary key, "role_id" integer, "is_grant" boolean NOT NULL, "has_grant_option" boolean NOT NULL, "class_name" character varying(40) NOT NULL, "privilege" character varying(40) NOT NULL, "target_owned_by_self" boolean NOT NULL, "target_owner_id" integer, "target_owner_firm_id" integer, "target_id" integer, "target_name" character varying(100), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (62.2ms) CREATE INDEX "index_permissions_on_role_id" ON "permissions" ("role_id") SQL (19.9ms) DROP TABLE "request_log_entries" SQL (117.8ms) CREATE TABLE "request_log_entries" ("id" serial primary key, "created_at" timestamp, "updated_at" timestamp, "acting_user_id" integer, "user_of_record_id" integer, "acting_user_name" character varying(255), "user_of_record_name" character varying(255), "controller" character varying(100) NOT NULL, "action" character varying(100) NOT NULL, "http_method" character varying(50) NOT NULL, "status" character varying(100) NOT NULL, "model_class" character varying(100), "model_id" integer, "remote_ip" character varying(50))  SQL (12.2ms) DROP TABLE "role_assignments" SQL (98.1ms) CREATE TABLE "role_assignments" ("id" serial primary key, "user_id" integer NOT NULL, "role_id" integer NOT NULL, "default_user_id" integer, "default_firm_id" integer, "invalid_after" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (20.4ms) DROP TABLE "roles" SQL (74.4ms) CREATE TABLE "roles" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (62.2ms) CREATE INDEX "roles_by_firm" ON "roles" ("owner_firm_id") SQL (61.3ms) CREATE INDEX "roles_by_owner" ON "roles" ("owner_id") SQL (8.7ms) DROP TABLE "users" SQL (64.4ms) CREATE TABLE "users" ("id" serial primary key, "name" character varying(100) NOT NULL, "owner_firm_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (1.4ms) SELECT version FROM "schema_migrations" SQL (0.1ms) BEGIN Firm Load (0.6ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.7ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.7ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 Firm Load (0.5ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (1.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.6ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:18:29.310928', '2011-04-18 11:18:29.310928', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(5) SQL (2.0ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.7ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:18:29.333567', '2011-04-18 11:18:29.333567', 5, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(5) SQL (2.0ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:29.357335', 'f', NULL, NULL, '2011-04-18 11:18:29.357335', 5, 2, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.8ms) SELECT * FROM "blogs" WHERE ("blogs"."owner_firm_id" = 2)  Blog Load (2.0ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.9ms) SELECT * FROM "blogs" WHERE (name like 'ric%') AND ("blogs"."owner_firm_id" = 2)  Blog Load (1.9ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) and name like 'ric%')  Blog Load (0.5ms) SELECT * FROM "blogs" WHERE (name like 'ricky%') AND ("blogs"."owner_firm_id" = 2)  Blog Load (1.8ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) and name like 'ricky%')  SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(5) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 5 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.5ms) DELETE FROM "role_assignments" WHERE "id" = 22 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.4ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 1)  Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role twiddler(3) SQL (1.8ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.7ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 'f', '2011-04-18 11:18:29.422335', NULL, NULL, '2011-04-18 11:18:29.422335', 3, NULL, 'any', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.431295', "created_at" = '2011-04-18 11:18:29.422335', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 87 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.435556', "created_at" = '2011-04-18 11:18:29.422335', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 87 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.439365', "created_at" = '2011-04-18 11:18:29.422335', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 87 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.442034', "created_at" = '2011-04-18 11:18:29.422335', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 't', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 87 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.445344', "created_at" = '2011-04-18 11:18:29.422335', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 87 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.447921', "created_at" = '2011-04-18 11:18:29.422335', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 87 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.3ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.451167', "created_at" = '2011-04-18 11:18:29.422335', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 87 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 4)  === permission check: edit Role twiddler(3) SQL (1.1ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 'f', '2011-04-18 11:18:29.460767', NULL, NULL, '2011-04-18 11:18:29.460767', 3, 2, 'any', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.464798', "created_at" = '2011-04-18 11:18:29.460767', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 88 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.468204', "created_at" = '2011-04-18 11:18:29.460767', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 88 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (1.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.471560', "created_at" = '2011-04-18 11:18:29.460767', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 88 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.475488', "created_at" = '2011-04-18 11:18:29.460767', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 't', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 88 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.478909', "created_at" = '2011-04-18 11:18:29.460767', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 88 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.481675', "created_at" = '2011-04-18 11:18:29.460767', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = 2 WHERE "id" = 88 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.484934', "created_at" = '2011-04-18 11:18:29.460767', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 88 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role twiddler(3) SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 't', '2011-04-18 11:18:29.492607', NULL, NULL, '2011-04-18 11:18:29.492607', 3, NULL, 'any', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.496875', "created_at" = '2011-04-18 11:18:29.492607', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 89 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.540966', "created_at" = '2011-04-18 11:18:29.492607', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 89 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.544533', "created_at" = '2011-04-18 11:18:29.492607', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 89 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.3ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.547332', "created_at" = '2011-04-18 11:18:29.492607', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 't', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 89 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.550641', "created_at" = '2011-04-18 11:18:29.492607', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 89 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.553215', "created_at" = '2011-04-18 11:18:29.492607', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 89 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.556892', "created_at" = '2011-04-18 11:18:29.492607', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 89 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Blog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  === permission check: edit Role twiddler(3) SQL (1.1ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 'f', '2011-04-18 11:18:29.564451', 1, 'mertz family blog', '2011-04-18 11:18:29.564451', 3, NULL, 'any', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.568707', "created_at" = '2011-04-18 11:18:29.564451', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.571825', "created_at" = '2011-04-18 11:18:29.564451', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 90 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.575146', "created_at" = '2011-04-18 11:18:29.564451', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.577802', "created_at" = '2011-04-18 11:18:29.564451', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 't', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 90 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.581233', "created_at" = '2011-04-18 11:18:29.564451', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.3ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.583852', "created_at" = '2011-04-18 11:18:29.564451', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 90 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:18:29.587138', "created_at" = '2011-04-18 11:18:29.564451', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.3ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'Ricardo blog' AND "blogs"."owner_firm_id" IS NULL) LIMIT 1 SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:18:29.602527', '2011-04-18 11:18:29.602527', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(6) SQL (1.1ms) select 'x' from roles where id = 6 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:18:29.611284', '2011-04-18 11:18:29.611284', 6, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.2ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:18:29.621309', '2011-04-18 11:18:29.621309', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  === FAILED permission check: grok Blog mertz family blog(1) === FAILED permission check: grok Blog mertz family blog(1) SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.1ms) select 'x' from roles where id = 6 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 6)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 'f', '2011-04-18 11:18:29.634593', 1, 'mertz family blog', '2011-04-18 11:18:29.634593', 6, NULL, 'grok', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: grok Blog mertz family blog(1) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(6) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 6 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 23 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 24 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:18:29.662969', '2011-04-18 11:18:29.662969', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(7) SQL (1.1ms) select 'x' from roles where id = 7 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:18:29.671569', '2011-04-18 11:18:29.671569', 7, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.1ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.4ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:18:29.682184', '2011-04-18 11:18:29.682184', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.1ms) select 'x' from roles where id = 7 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 7)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 't', '2011-04-18 11:18:29.693180', NULL, NULL, '2011-04-18 11:18:29.693180', 7, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.1ms) select 'x' from roles where id = 7 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 7)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 't', '2011-04-18 11:18:29.703822', NULL, NULL, '2011-04-18 11:18:29.703822', 7, NULL, 'any', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "permissions" WHERE ("permissions".role_id = 7)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(7) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 7 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 25 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 26 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 4 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:18:29.742738', '2011-04-18 11:18:29.742738', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(8) SQL (1.1ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:18:29.751255', '2011-04-18 11:18:29.751255', 8, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.1ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:18:29.760952', '2011-04-18 11:18:29.760952', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 5' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.6ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 5', '2011-04-18 11:18:29.772701', '2011-04-18 11:18:29.772701', 5, 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 Blog Load (0.6ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 6' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 6', '2011-04-18 11:18:29.788082', '2011-04-18 11:18:29.788082', 5, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 7' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 7', '2011-04-18 11:18:29.796343', '2011-04-18 11:18:29.796343', 3, 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 8' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 8', '2011-04-18 11:18:29.804337', '2011-04-18 11:18:29.804337', 3, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 9' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 9', '2011-04-18 11:18:29.812042', '2011-04-18 11:18:29.812042', 4, 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 10' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 10', '2011-04-18 11:18:29.819705', '2011-04-18 11:18:29.819705', 4, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.8ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:29.836962', 'f', NULL, NULL, '2011-04-18 11:18:29.836962', 3, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.7ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:29.848113', 'f', NULL, NULL, '2011-04-18 11:18:29.848113', 3, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.8ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:29.859456', 't', NULL, NULL, '2011-04-18 11:18:29.859456', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.8ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:29.870426', 'f', 1, 'mertz family blog', '2011-04-18 11:18:29.870426', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.5ms) SELECT count(*) AS count_all FROM "permissions" WHERE ("permissions".role_id = 8)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE ("permissions".role_id = 4)  SQL (1.9ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(8) SQL (1.8ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.8ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:29.892322', 'f', NULL, NULL, '2011-04-18 11:18:29.892322', 8, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.3ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.7ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:29.902942', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:29.892322', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 98 SQL (1.8ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 Permission Update (0.8ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:29.916352', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:29.892322', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 98 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:29.920983', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:29.892322', "target_name" = NULL, "is_grant" = 't', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 98 SQL (1.9ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 Permission Update (0.7ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:29.934375', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:29.892322', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 98 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.8ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:29.938713', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:29.892322', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 98 SQL (1.8ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.7ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:29.951963', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:29.892322', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 98 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:29.956184', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:29.892322', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'any', "target_owner_firm_id" = NULL WHERE "id" = 98 RoleAssignment Load (0.5ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 8)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  RoleAssignment Update (0.5ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:29.965101', "invalid_after" = '2011-04-18 11:18:29.102546' WHERE "id" = 27 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (2.0ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.2ms) SAVEPOINT active_record_1 RoleAssignment Update (0.6ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:29.972968', "invalid_after" = '2011-04-17 11:18:29.102894' WHERE "id" = 27 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (1.8ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:29.982899', "invalid_after" = NULL WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 8)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.2ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:29.988407', "invalid_after" = '2011-04-19 11:18:29.103142' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.1ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.008611', "invalid_after" = '2011-04-20 11:18:29.103378' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.1ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.028707', "invalid_after" = NULL WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.4ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.051311', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:29.892322', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 98 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 8)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.2ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.056869', "invalid_after" = '2011-04-18 11:18:29.102546' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.061432', "invalid_after" = '2011-04-17 11:18:29.102894' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.065894', "invalid_after" = NULL WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 8)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.071250', "invalid_after" = '2011-04-19 11:18:29.103142' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.1ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.091567', "invalid_after" = '2011-04-20 11:18:29.103378' WHERE "id" = 27 SQL (0.4ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.1ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.112114', "invalid_after" = NULL WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.1ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 98 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:30.195645', 'f', NULL, NULL, '2011-04-18 11:18:30.195645', 8, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.202317', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:30.195645', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 99 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.7ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.211118', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:30.195645', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 99 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.214455', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:30.195645', "target_name" = NULL, "is_grant" = 't', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 99 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.223068', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:30.195645', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 99 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.225919', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:30.195645', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = 3 WHERE "id" = 99 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.234556', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:30.195645', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 99 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.3ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.237313', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:30.195645', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'any', "target_owner_firm_id" = 3 WHERE "id" = 99 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 8)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.242916', "invalid_after" = '2011-04-18 11:18:29.102546' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.247954', "invalid_after" = '2011-04-17 11:18:29.102894' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.252697', "invalid_after" = NULL WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 8)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.258191', "invalid_after" = '2011-04-19 11:18:29.103142' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.279011', "invalid_after" = '2011-04-20 11:18:29.103378' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.1ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.299830', "invalid_after" = NULL WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.1ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.323338', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:30.195645', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 99 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 8)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.2ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.329026', "invalid_after" = '2011-04-18 11:18:29.102546' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.6ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.334954', "invalid_after" = '2011-04-17 11:18:29.102894' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.339566', "invalid_after" = NULL WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.5ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 8)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.2ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.345637', "invalid_after" = '2011-04-19 11:18:29.103142' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.367993', "invalid_after" = '2011-04-20 11:18:29.103378' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.7ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.391491', "invalid_after" = NULL WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.6ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.5ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 99 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:30.431152', 't', NULL, NULL, '2011-04-18 11:18:30.431152', 8, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.438182', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:18:30.431152', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 100 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.447035', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:18:30.431152', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 100 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.449942', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:18:30.431152', "target_name" = NULL, "is_grant" = 't', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 100 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.459170', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:18:30.431152', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 100 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.462108', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:18:30.431152', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 100 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.471942', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:18:30.431152', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 100 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.474869', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:18:30.431152', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'any', "target_owner_firm_id" = NULL WHERE "id" = 100 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 8)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.481526', "invalid_after" = '2011-04-18 11:18:29.102546' WHERE "id" = 27 SQL (0.3ms) RELEASE SAVEPOINT active_record_1 SQL (1.4ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.487469', "invalid_after" = '2011-04-17 11:18:29.102894' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.492566', "invalid_after" = NULL WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.7ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 8)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.6ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.499595', "invalid_after" = '2011-04-19 11:18:29.103142' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.518022', "invalid_after" = '2011-04-20 11:18:29.103378' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.536532', "invalid_after" = NULL WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.557433', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:18:30.431152', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 100 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 8)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.563816', "invalid_after" = '2011-04-18 11:18:29.102546' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.568988', "invalid_after" = '2011-04-17 11:18:29.102894' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.6ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.574365', "invalid_after" = NULL WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 8)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.580961', "invalid_after" = '2011-04-19 11:18:29.103142' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.600189', "invalid_after" = '2011-04-20 11:18:29.103378' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.3ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.618218', "invalid_after" = NULL WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.5ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 100 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:30.651306', 'f', 1, 'mertz family blog', '2011-04-18 11:18:30.651306', 8, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.657957', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:30.651306', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 101 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.666948', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:30.651306', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 101 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.670264', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:30.651306', "target_name" = 'mertz family blog', "is_grant" = 't', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 101 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.680371', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:30.651306', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 101 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.683318', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:30.651306', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 101 SQL (1.4ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.693329', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:30.651306', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 101 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.696815', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:30.651306', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'any', "target_owner_firm_id" = NULL WHERE "id" = 101 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 8)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.703193', "invalid_after" = '2011-04-18 11:18:29.102546' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.708429', "invalid_after" = '2011-04-17 11:18:29.102894' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.714041', "invalid_after" = NULL WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (17.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 8)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.773216', "invalid_after" = '2011-04-19 11:18:29.103142' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.1ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.5ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.797282', "invalid_after" = '2011-04-20 11:18:29.103378' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.6ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.822652', "invalid_after" = NULL WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.4ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 8, "updated_at" = '2011-04-18 11:18:30.848219', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:18:30.651306', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 101 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 8)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.854923', "invalid_after" = '2011-04-18 11:18:29.102546' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.860791', "invalid_after" = '2011-04-17 11:18:29.102894' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.865997', "invalid_after" = NULL WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 8)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.872714', "invalid_after" = '2011-04-19 11:18:29.103142' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.8ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.895835', "invalid_after" = '2011-04-20 11:18:29.103378' WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:30.920412', "invalid_after" = NULL WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 101 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:30.954187', 'f', NULL, NULL, '2011-04-18 11:18:30.954187', 8, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:30.961324', 'f', NULL, NULL, '2011-04-18 11:18:30.961324', 8, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 102 SQL (0.4ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 103 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.008178', 'f', NULL, NULL, '2011-04-18 11:18:31.008178', 8, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.3ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.015330', 't', NULL, NULL, '2011-04-18 11:18:31.015330', 8, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 104 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 105 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(8) SQL (1.4ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.054564', 'f', NULL, NULL, '2011-04-18 11:18:31.054564', 8, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.061626', 'f', 1, 'mertz family blog', '2011-04-18 11:18:31.061626', 8, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.7ms) DELETE FROM "permissions" WHERE "id" = 106 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 107 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.108880', 'f', NULL, NULL, '2011-04-18 11:18:31.108880', 8, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(8) SQL (1.5ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.116737', 'f', NULL, NULL, '2011-04-18 11:18:31.116737', 8, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 108 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 109 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.162045', 'f', NULL, NULL, '2011-04-18 11:18:31.162045', 8, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.169064', 't', NULL, NULL, '2011-04-18 11:18:31.169064', 8, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.5ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.6ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 110 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 111 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.210287', 'f', NULL, NULL, '2011-04-18 11:18:31.210287', 8, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(8) SQL (1.5ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.217756', 'f', 1, 'mertz family blog', '2011-04-18 11:18:31.217756', 8, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 112 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.5ms) DELETE FROM "permissions" WHERE "id" = 113 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.263768', 't', NULL, NULL, '2011-04-18 11:18:31.263768', 8, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(8) SQL (1.1ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.270269', 'f', NULL, NULL, '2011-04-18 11:18:31.270269', 8, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.5ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.6ms) DELETE FROM "permissions" WHERE "id" = 114 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 115 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(8) SQL (1.4ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.310422', 't', NULL, NULL, '2011-04-18 11:18:31.310422', 8, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.317867', 'f', NULL, NULL, '2011-04-18 11:18:31.317867', 8, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.5ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 116 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 117 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.356999', 't', NULL, NULL, '2011-04-18 11:18:31.356999', 8, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.363948', 'f', 1, 'mertz family blog', '2011-04-18 11:18:31.363948', 8, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.4ms) DELETE FROM "permissions" WHERE "id" = 118 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.2ms) DELETE FROM "permissions" WHERE "id" = 119 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(8) SQL (1.3ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.405118', 'f', 1, 'mertz family blog', '2011-04-18 11:18:31.405118', 8, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(8) SQL (2.0ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.412952', 'f', NULL, NULL, '2011-04-18 11:18:31.412952', 8, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 120 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 121 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.458721', 'f', 1, 'mertz family blog', '2011-04-18 11:18:31.458721', 8, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.466177', 'f', NULL, NULL, '2011-04-18 11:18:31.466177', 8, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 122 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 123 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(8) SQL (1.2ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.512867', 'f', 1, 'mertz family blog', '2011-04-18 11:18:31.512867', 8, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(8) SQL (1.4ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.520784', 't', NULL, NULL, '2011-04-18 11:18:31.520784', 8, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 124 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(8) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 125 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(8) Role Destroy (1.2ms) DELETE FROM "roles" WHERE "id" = 8 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 28 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:18:31.580958', '2011-04-18 11:18:31.580958', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(9) SQL (1.4ms) select 'x' from roles where id = 9 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.4ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:18:31.591516', '2011-04-18 11:18:31.591516', 9, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.5ms) SELECT count(*) AS count_all FROM "users" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'frammis' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 5) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 9 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 9)  SQL (20.3ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('User', 't', '2011-04-18 11:18:31.605093', NULL, NULL, '2011-04-18 11:18:31.605093', 9, NULL, 'any', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.2ms) SELECT count(*) AS count_all FROM "users" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'frammis' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 5) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) ) )  User Load (2.0ms) SELECT * FROM "users" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'frammis' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 5) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(9) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 9 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 29 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN Blog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:18:31.707163', '2011-04-18 11:18:31.707163', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(10) SQL (1.2ms) select 'x' from roles where id = 10 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:18:31.718646', '2011-04-18 11:18:31.718646', 10, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: edit Role twiddler(3) === permission check: edit Role test role(10) SQL (1.2ms) select 'x' from roles where id = 10 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Role', '2011-04-18 11:18:31.731616', 'f', 3, 'twiddler', '2011-04-18 11:18:31.731616', 10, NULL, 'edit', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role twiddler(3) SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(10) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 10 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 30 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.5ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:18:31.755447', '2011-04-18 11:18:31.755447', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(11) SQL (1.4ms) select 'x' from roles where id = 11 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:18:31.765183', '2011-04-18 11:18:31.765183', 11, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 === permission check: edit Role test role(11) SQL (1.3ms) select 'x' from roles where id = 11 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.779400', 'f', NULL, NULL, '2011-04-18 11:18:31.779400', 11, NULL, 'post', 'f', 't', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:18:31.785011', 'f', NULL, NULL, '2011-04-18 11:18:31.785011', 3, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(11) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 11 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 31 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:18:31.804490', '2011-04-18 11:18:31.804490', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(12) SQL (1.2ms) select 'x' from roles where id = 12 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:18:31.813934', '2011-04-18 11:18:31.813934', 12, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.8ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 === FAILED permission check: edit Role twiddler(3) SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 === permission check: edit Role test role(12) SQL (1.2ms) select 'x' from roles where id = 12 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Role', '2011-04-18 11:18:31.826632', 'f', 3, 'twiddler', '2011-04-18 11:18:31.826632', 12, NULL, 'edit', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role twiddler(3) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 129 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(12) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 12 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 32 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 3 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 1)  Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions".role_id = 1)  Role Load (0.2ms) SELECT * FROM "roles" WHERE ("roles"."id" = 2)  Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions".role_id = 2)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.1ms) select 'x' from roles where id = 1 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from roles where id = 1 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.9ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.9ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.2ms) SELECT * FROM "roles" WHERE ("roles"."id" = 1)  SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:18:31.869116', '2011-04-18 11:18:31.869116', 1, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 2 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from roles where id = 2 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 2)  SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:18:31.885417', '2011-04-18 11:18:31.885417', 2, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 1)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 1)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:31.897040', "invalid_after" = '2011-04-19 11:18:29.103142' WHERE "id" = 33 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.7ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:31.905427', "invalid_after" = '2011-04-20 11:18:29.103378' WHERE "id" = 33 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:31.912791', "invalid_after" = NULL WHERE "id" = 33 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 1)) LIMIT 1 SQL (0.2ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 1)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:31.925455', "invalid_after" = '2011-04-18 11:18:29.102546' WHERE "id" = 33 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:31.933164', "invalid_after" = '2011-04-17 11:18:29.102894' WHERE "id" = 33 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:18:31.941425', "invalid_after" = NULL WHERE "id" = 33 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) ROLLBACK SQL (0.3ms) SET client_min_messages TO 'ERROR' SQL (0.1ms) SET client_min_messages TO 'panic' SQL (0.2ms) SET standard_conforming_strings = on SQL (0.1ms) SET client_min_messages TO 'error' SQL (12.6ms) DROP TABLE "blog_entries" SQL (130.1ms) CREATE TABLE "blog_entries" ("id" serial primary key, "blog_id" integer NOT NULL, "entry_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (60.7ms) CREATE INDEX "blog_entries_by_firm" ON "blog_entries" ("owner_firm_id") SQL (87.2ms) CREATE INDEX "blog_entries_by_owner" ON "blog_entries" ("owner_id") SQL (10.2ms) DROP TABLE "blogs" SQL (96.9ms) CREATE TABLE "blogs" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (52.5ms) CREATE INDEX "blogs_by_firm" ON "blogs" ("owner_firm_id") SQL (73.3ms) CREATE INDEX "blogs_by_owner" ON "blogs" ("owner_id") SQL (61.8ms) CREATE UNIQUE INDEX "ix_blogs_by_name_owner_firm" ON "blogs" ("name", "owner_firm_id") SQL (15.7ms) DROP TABLE "entry_comments" SQL (124.4ms) CREATE TABLE "entry_comments" ("id" serial primary key, "blog_entry_id" integer, "comment_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (54.9ms) CREATE INDEX "entry_comments_by_firm" ON "entry_comments" ("owner_firm_id") SQL (51.3ms) CREATE INDEX "entry_comments_by_owner" ON "entry_comments" ("owner_id") SQL (20.4ms) DROP TABLE "firms" SQL (76.1ms) CREATE TABLE "firms" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (8.9ms) DROP TABLE "pcheck_log_entries" SQL (75.6ms) CREATE TABLE "pcheck_log_entries" ("id" serial primary key, "request_log_entry_id" integer NOT NULL, "success" boolean NOT NULL, "model_class" character varying(100) NOT NULL, "model_id" integer, "privilege" character varying(40) NOT NULL, "user_id" integer NOT NULL, "user_name" character varying(100) NOT NULL, "created_at" timestamp, "updated_at" timestamp)  SQL (9.5ms) DROP TABLE "permissions" SQL (75.2ms) CREATE TABLE "permissions" ("id" serial primary key, "role_id" integer, "is_grant" boolean NOT NULL, "has_grant_option" boolean NOT NULL, "class_name" character varying(40) NOT NULL, "privilege" character varying(40) NOT NULL, "target_owned_by_self" boolean NOT NULL, "target_owner_id" integer, "target_owner_firm_id" integer, "target_id" integer, "target_name" character varying(100), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (52.3ms) CREATE INDEX "index_permissions_on_role_id" ON "permissions" ("role_id") SQL (17.1ms) DROP TABLE "request_log_entries" SQL (107.9ms) CREATE TABLE "request_log_entries" ("id" serial primary key, "created_at" timestamp, "updated_at" timestamp, "acting_user_id" integer, "user_of_record_id" integer, "acting_user_name" character varying(255), "user_of_record_name" character varying(255), "controller" character varying(100) NOT NULL, "action" character varying(100) NOT NULL, "http_method" character varying(50) NOT NULL, "status" character varying(100) NOT NULL, "model_class" character varying(100), "model_id" integer, "remote_ip" character varying(50))  SQL (12.3ms) DROP TABLE "role_assignments" SQL (97.1ms) CREATE TABLE "role_assignments" ("id" serial primary key, "user_id" integer NOT NULL, "role_id" integer NOT NULL, "default_user_id" integer, "default_firm_id" integer, "invalid_after" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (75.5ms) DROP TABLE "roles" SQL (64.4ms) CREATE TABLE "roles" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (52.2ms) CREATE INDEX "roles_by_firm" ON "roles" ("owner_firm_id") SQL (62.2ms) CREATE INDEX "roles_by_owner" ON "roles" ("owner_id") SQL (11.1ms) DROP TABLE "users" SQL (74.1ms) CREATE TABLE "users" ("id" serial primary key, "name" character varying(100) NOT NULL, "owner_firm_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (0.6ms) SELECT version FROM "schema_migrations" SQL (0.1ms) BEGIN User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.8ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:24.169064', '2011-04-18 11:20:24.169064', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(5) SQL (1.3ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:24.182998', '2011-04-18 11:20:24.182998', 5, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_guarded AcPhonyBlog X() === permission check: edit Role test role(5) SQL (1.4ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('AcPhonyBlog', '2011-04-18 11:20:24.200912', 'f', NULL, NULL, '2011-04-18 11:20:24.200912', 5, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(5) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 5 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:24.224954', '2011-04-18 11:20:24.224954', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(6) SQL (1.1ms) select 'x' from roles where id = 6 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:24.233518', '2011-04-18 11:20:24.233518', 6, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.1ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:24.242938', '2011-04-18 11:20:24.242938', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:24.289200', '2011-04-18 11:20:24.289200', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(7) SQL (1.1ms) select 'x' from roles where id = 7 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:24.297860', '2011-04-18 11:20:24.297860', 7, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_guarded AcPhonyBlog X() === permission check: edit Role test role(7) SQL (1.3ms) select 'x' from roles where id = 7 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('AcPhonyBlog', '2011-04-18 11:20:24.308992', 'f', NULL, NULL, '2011-04-18 11:20:24.308992', 7, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(7) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 7 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 25 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:24.329782', '2011-04-18 11:20:24.329782', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(8) SQL (1.1ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:24.338190', '2011-04-18 11:20:24.338190', 8, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.1ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:24.348031', '2011-04-18 11:20:24.348031', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.1ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('AcPhonyBlog', 'f', '2011-04-18 11:20:24.361834', NULL, 'fred the blog', '2011-04-18 11:20:24.361834', 8, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(8) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 8 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 26 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:24.393572', '2011-04-18 11:20:24.393572', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(9) SQL (1.1ms) select 'x' from roles where id = 9 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:24.402380', '2011-04-18 11:20:24.402380', 9, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_guarded AcPhonyBlog X() === permission check: edit Role test role(9) SQL (1.2ms) select 'x' from roles where id = 9 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('AcPhonyBlog', '2011-04-18 11:20:24.413494', 'f', NULL, NULL, '2011-04-18 11:20:24.413494', 9, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(9) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 9 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 28 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 Role Load (0.5ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.5ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:24.444138', '2011-04-18 11:20:24.444138', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(10) SQL (1.9ms) select 'x' from roles where id = 10 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.7ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:24.458682', '2011-04-18 11:20:24.458682', 10, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.8ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.6ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:24.474044', '2011-04-18 11:20:24.474044', 4, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 10 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 10)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('AcPhonyBlog', 'f', '2011-04-18 11:20:24.557828', NULL, 'fred the blog', '2011-04-18 11:20:24.557828', 10, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(10) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 10 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 29 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 30 SQL (0.3ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:24.595506', '2011-04-18 11:20:24.595506', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(11) SQL (1.1ms) select 'x' from roles where id = 11 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:24.604500', '2011-04-18 11:20:24.604500', 11, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_guarded AcPhonyBlog X() === permission check: edit Role test role(11) SQL (1.2ms) select 'x' from roles where id = 11 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('AcPhonyBlog', '2011-04-18 11:20:24.616105', 'f', NULL, NULL, '2011-04-18 11:20:24.616105', 11, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(11) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 11 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 31 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:24.637113', '2011-04-18 11:20:24.637113', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(12) SQL (1.3ms) select 'x' from roles where id = 12 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:24.646133', '2011-04-18 11:20:24.646133', 12, 5, NULL, NULL) RETURNING "id" SQL (0.9ms) RELEASE SAVEPOINT active_record_1 Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.1ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:24.657143', '2011-04-18 11:20:24.657143', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 12 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 12)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('AcPhonyBlog', 'f', '2011-04-18 11:20:25.348968', NULL, 'fred the blog', '2011-04-18 11:20:25.348968', 12, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(12) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 12 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 32 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 33 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:25.378744', '2011-04-18 11:20:25.378744', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(13) SQL (1.1ms) select 'x' from roles where id = 13 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:25.387472', '2011-04-18 11:20:25.387472', 13, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role universal_grant(4) SQL (1.1ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:25.396629', '2011-04-18 11:20:25.396629', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:25.413988', '2011-04-18 11:20:25.413988', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(14) SQL (1.1ms) select 'x' from roles where id = 14 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:25.423239', '2011-04-18 11:20:25.423239', 14, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_guarded AcPhonyBlog X() === permission check: edit Role test role(14) SQL (1.3ms) select 'x' from roles where id = 14 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('AcPhonyBlog', '2011-04-18 11:20:25.435630', 'f', NULL, NULL, '2011-04-18 11:20:25.435630', 14, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(14) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 14 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 36 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.7ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:25.456723', '2011-04-18 11:20:25.456723', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(15) SQL (1.1ms) select 'x' from roles where id = 15 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:25.465311', '2011-04-18 11:20:25.465311', 15, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.1ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:25.474774', '2011-04-18 11:20:25.474774', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 15 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 15)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('AcPhonyBlog', 'f', '2011-04-18 11:20:25.488422', NULL, 'fred the blog', '2011-04-18 11:20:25.488422', 15, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(15) Role Destroy (0.2ms) DELETE FROM "roles" WHERE "id" = 15 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 37 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 38 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:25.519374', '2011-04-18 11:20:25.519374', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(16) SQL (1.1ms) select 'x' from roles where id = 16 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:25.527874', '2011-04-18 11:20:25.527874', 16, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_guarded AcPhonyBlog X() === permission check: edit Role test role(16) SQL (1.7ms) select 'x' from roles where id = 16 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('AcPhonyBlog', '2011-04-18 11:20:25.539270', 'f', NULL, NULL, '2011-04-18 11:20:25.539270', 16, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(16) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 16 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 39 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:25.559495', '2011-04-18 11:20:25.559495', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(17) SQL (1.1ms) select 'x' from roles where id = 17 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:25.568042', '2011-04-18 11:20:25.568042', 17, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.1ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:25.577941', '2011-04-18 11:20:25.577941', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.1ms) select 'x' from roles where id = 17 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 17)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('AcPhonyBlog', 'f', '2011-04-18 11:20:25.591764', NULL, 'fred the blog', '2011-04-18 11:20:25.591764', 17, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(17) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 17 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 40 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 41 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:25.622045', '2011-04-18 11:20:25.622045', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(18) SQL (1.1ms) select 'x' from roles where id = 18 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:25.630625', '2011-04-18 11:20:25.630625', 18, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_guarded AcPhonyBlog X() === permission check: edit Role test role(18) SQL (1.2ms) select 'x' from roles where id = 18 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('AcPhonyBlog', '2011-04-18 11:20:25.641333', 'f', NULL, NULL, '2011-04-18 11:20:25.641333', 18, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(18) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 18 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 42 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:25.661797', '2011-04-18 11:20:25.661797', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(19) SQL (1.1ms) select 'x' from roles where id = 19 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:25.670463', '2011-04-18 11:20:25.670463', 19, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.1ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:25.679816', '2011-04-18 11:20:25.679816', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.1ms) select 'x' from roles where id = 19 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 19)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('AcPhonyBlog', 'f', '2011-04-18 11:20:25.693564', NULL, 'fred the blog', '2011-04-18 11:20:25.693564', 19, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(19) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 19 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 43 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 44 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) ROLLBACK SQL (0.3ms) BEGIN User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:25.780731', '2011-04-18 11:20:25.780731', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(20) SQL (1.2ms) select 'x' from roles where id = 20 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:25.790976', '2011-04-18 11:20:25.790976', 20, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_guarded AcPhonyBlog X() === permission check: edit Role test role(20) SQL (1.1ms) select 'x' from roles where id = 20 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('AcPhonyBlog', '2011-04-18 11:20:25.802291', 'f', NULL, NULL, '2011-04-18 11:20:25.802291', 20, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(20) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 20 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 45 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:25.823903', '2011-04-18 11:20:25.823903', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(21) SQL (1.1ms) select 'x' from roles where id = 21 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:25.833328', '2011-04-18 11:20:25.833328', 21, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.1ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:25.843329', '2011-04-18 11:20:25.843329', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.9ms) select 'x' from roles where id = 21 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 21)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('AcPhonyBlog', 'f', '2011-04-18 11:20:25.859573', NULL, 'fred the blog', '2011-04-18 11:20:25.859573', 21, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(21) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 21 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 46 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 47 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN Firm Load (0.5ms) SELECT * FROM "firms" WHERE ("firms"."id" = 4)  Blog Load (1.0ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" IS NULL AND "blogs"."owner_firm_id" IS NULL) LIMIT 1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" IS NULL AND "blogs"."owner_firm_id" = 4) LIMIT 1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 2)  Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" IS NULL AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" IS NULL AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" IS NULL AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = '' AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'x' AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'ab' AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.6ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'mertz family blog' AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.6ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'ricardo family blog' AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' AND "blogs"."owner_firm_id" = 4) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' AND "blogs"."owner_firm_id" = 4) LIMIT 1 SQL (0.6ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', '2011-04-18 11:20:25.952095', '2011-04-18 11:20:25.952095', 2, 4) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.4ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.4ms) BEGIN User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 2)  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 4)  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 2)  SQL (1.6ms) select 'x' from roles where id = 2 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 4 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 4) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.4ms) select 'x' from roles where id = 2 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 4 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 4) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.6ms) SELECT * FROM "roles" WHERE ("roles"."id" = 1)  Permission Load (1.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 4 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === FAILED permission check: assign Role admin(1) SQL (0.2ms) ROLLBACK SQL (0.2ms) BEGIN User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 2)  Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 4 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role admin(2) Role Load (0.6ms) SELECT * FROM "roles" WHERE ("roles"."id" = 1)  === FAILED permission check: edit Role admin(1) SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 2)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role admin(2) SQL (1.8ms) select 'x' from roles where id = 2 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 'f', '2011-04-18 11:20:27.066646', NULL, NULL, '2011-04-18 11:20:27.066646', 2, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 User Load (0.8ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 4 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role admin(2) SQL (1.4ms) select 'x' from roles where id = 2 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 4 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 4) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN Blog Load (0.4ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Blog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 1)  User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.7ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.5ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.5ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:27.107199', '2011-04-18 11:20:27.107199', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(22) SQL (1.3ms) select 'x' from roles where id = 22 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.3ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:27.117599', '2011-04-18 11:20:27.117599', 22, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: edit Role admin(1) === permission check: edit Role test role(22) SQL (1.5ms) select 'x' from roles where id = 22 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Role', '2011-04-18 11:20:27.131537', 'f', 1, 'admin', '2011-04-18 11:20:27.131537', 22, NULL, 'edit', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role admin(1) SQL (1.3ms) select 'x' from roles where id = 1 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(22) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 48 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.6ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 'f', '2011-04-18 11:20:27.167851', NULL, NULL, '2011-04-18 11:20:27.167851', 1, NULL, 'any', 'f', 'f', NULL) RETURNING "id" SQL (0.3ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.5ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.6ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:27.185380', '2011-04-18 11:20:27.185380', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(23) SQL (2.3ms) select 'x' from roles where id = 23 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.3ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:27.197659', '2011-04-18 11:20:27.197659', 23, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(23) SQL (1.5ms) select 'x' from roles where id = 23 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:27.210165', 'f', NULL, NULL, '2011-04-18 11:20:27.210165', 23, 2, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.6ms) SELECT * FROM "blogs" WHERE ("blogs"."owner_firm_id" = 2)  Blog Load (1.5ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.0ms) SELECT * FROM "blogs" WHERE (name like 'ric%') AND ("blogs"."owner_firm_id" = 2)  Blog Load (1.4ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) and name like 'ric%')  Blog Load (0.4ms) SELECT * FROM "blogs" WHERE (name like 'ricky%') AND ("blogs"."owner_firm_id" = 2)  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) and name like 'ricky%')  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(23) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 23 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.5ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 49 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 1)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role twiddler(3) SQL (1.6ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.5ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 'f', '2011-04-18 11:20:27.255995', NULL, NULL, '2011-04-18 11:20:27.255995', 3, NULL, 'any', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.7ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.261221', "created_at" = '2011-04-18 11:20:27.255995', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 105 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.265334', "created_at" = '2011-04-18 11:20:27.255995', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 105 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.7ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.271558', "created_at" = '2011-04-18 11:20:27.255995', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 105 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.7ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.275269', "created_at" = '2011-04-18 11:20:27.255995', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 105 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.7ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.280124', "created_at" = '2011-04-18 11:20:27.255995', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 105 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.283386', "created_at" = '2011-04-18 11:20:27.255995', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 't', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 105 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.287983', "created_at" = '2011-04-18 11:20:27.255995', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 105 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 4)  === permission check: edit Role twiddler(3) SQL (1.3ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.5ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 'f', '2011-04-18 11:20:27.299765', NULL, NULL, '2011-04-18 11:20:27.299765', 3, 2, 'any', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.304734', "created_at" = '2011-04-18 11:20:27.299765', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 106 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.308224', "created_at" = '2011-04-18 11:20:27.299765', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 106 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.312316', "created_at" = '2011-04-18 11:20:27.299765', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 106 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.315710', "created_at" = '2011-04-18 11:20:27.299765', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = 2 WHERE "id" = 106 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.7ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.319694', "created_at" = '2011-04-18 11:20:27.299765', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 106 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.323441', "created_at" = '2011-04-18 11:20:27.299765', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 't', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 106 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.327844', "created_at" = '2011-04-18 11:20:27.299765', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 106 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role twiddler(3) SQL (1.3ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.5ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 't', '2011-04-18 11:20:27.337614', NULL, NULL, '2011-04-18 11:20:27.337614', 3, NULL, 'any', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.342558', "created_at" = '2011-04-18 11:20:27.337614', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 107 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.346876', "created_at" = '2011-04-18 11:20:27.337614', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 107 SQL (0.3ms) SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.351409', "created_at" = '2011-04-18 11:20:27.337614', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 107 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.7ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.355065', "created_at" = '2011-04-18 11:20:27.337614', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 107 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.359207', "created_at" = '2011-04-18 11:20:27.337614', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 107 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.362751', "created_at" = '2011-04-18 11:20:27.337614', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 't', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 107 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.367257', "created_at" = '2011-04-18 11:20:27.337614', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 107 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Blog Load (0.6ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  === permission check: edit Role twiddler(3) SQL (1.4ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.5ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 'f', '2011-04-18 11:20:27.378554', 1, 'mertz family blog', '2011-04-18 11:20:27.378554', 3, NULL, 'any', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.383856', "created_at" = '2011-04-18 11:20:27.378554', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 108 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.388385', "created_at" = '2011-04-18 11:20:27.378554', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 108 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.462964', "created_at" = '2011-04-18 11:20:27.378554', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 108 SQL (0.3ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.466998', "created_at" = '2011-04-18 11:20:27.378554', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 108 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.471341', "created_at" = '2011-04-18 11:20:27.378554', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 108 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.475330', "created_at" = '2011-04-18 11:20:27.378554', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 't', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 108 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:27.479574', "created_at" = '2011-04-18 11:20:27.378554', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 108 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'Ricardo blog' AND "blogs"."owner_firm_id" IS NULL) LIMIT 1 SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.9ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.7ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.6ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:27.500239', '2011-04-18 11:20:27.500239', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(24) SQL (1.4ms) select 'x' from roles where id = 24 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.3ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.1ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:27.511515', '2011-04-18 11:20:27.511515', 24, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.4ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.5ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:27.525033', '2011-04-18 11:20:27.525033', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  === FAILED permission check: grok Blog mertz family blog(1) === FAILED permission check: grok Blog mertz family blog(1) SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.3ms) select 'x' from roles where id = 24 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 24)  SQL (0.5ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 'f', '2011-04-18 11:20:27.544610', 1, 'mertz family blog', '2011-04-18 11:20:27.544610', 24, NULL, 'grok', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: grok Blog mertz family blog(1) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(24) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 24 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.5ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 50 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 51 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.6ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.6ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.5ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:27.583597', '2011-04-18 11:20:27.583597', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(25) SQL (1.7ms) select 'x' from roles where id = 25 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.3ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:27.594378', '2011-04-18 11:20:27.594378', 25, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.6ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.4ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.4ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:27.606281', '2011-04-18 11:20:27.606281', 4, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.3ms) select 'x' from roles where id = 25 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 25)  SQL (0.5ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 't', '2011-04-18 11:20:27.619606', NULL, NULL, '2011-04-18 11:20:27.619606', 25, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.4ms) select 'x' from roles where id = 25 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 25)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 't', '2011-04-18 11:20:27.633358', NULL, NULL, '2011-04-18 11:20:27.633358', 25, NULL, 'any', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "permissions" WHERE ("permissions".role_id = 25)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(25) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 25 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.7ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 52 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 53 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.2ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 4 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.5ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.5ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:27.683024', '2011-04-18 11:20:27.683024', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(26) SQL (1.9ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.3ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:27.694672', '2011-04-18 11:20:27.694672', 26, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.4ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.3ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:27.706625', '2011-04-18 11:20:27.706625', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Firm Load (0.6ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.5ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 5' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.7ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 5', '2011-04-18 11:20:27.721814', '2011-04-18 11:20:27.721814', 5, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 6' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 6', '2011-04-18 11:20:27.728673', '2011-04-18 11:20:27.728673', 5, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 7' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.3ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 7', '2011-04-18 11:20:27.736600', '2011-04-18 11:20:27.736600', 3, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 8' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 8', '2011-04-18 11:20:27.742623', '2011-04-18 11:20:27.742623', 3, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 9' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.7ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 9', '2011-04-18 11:20:27.748601', '2011-04-18 11:20:27.748601', 4, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.3ms) SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 10' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 10', '2011-04-18 11:20:27.756173', '2011-04-18 11:20:27.756173', 4, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Blog Load (0.5ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.7ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:27.769903', 'f', NULL, NULL, '2011-04-18 11:20:27.769903', 3, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:27.778203', 'f', NULL, NULL, '2011-04-18 11:20:27.778203', 3, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:27.785859', 't', NULL, NULL, '2011-04-18 11:20:27.785859', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:27.794818', 'f', 1, 'mertz family blog', '2011-04-18 11:20:27.794818', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "permissions" WHERE ("permissions".role_id = 26)  Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions".role_id = 4)  SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(26) SQL (1.2ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:27.809886', 'f', NULL, NULL, '2011-04-18 11:20:27.809886', 26, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:27.816853', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:27.809886', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 116 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:27.826753', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:27.809886', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 116 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:27.829643', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:27.809886', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 116 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:27.839410', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:27.809886', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 116 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:27.842504', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:27.809886', "target_name" = NULL, "is_grant" = 't', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 116 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:27.852646', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:27.809886', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 116 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:27.855774', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:27.809886', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'any', "target_owner_firm_id" = NULL WHERE "id" = 116 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 26)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  RoleAssignment Update (0.7ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:27.862399', "invalid_after" = '2011-04-18 11:20:23.821346' WHERE "id" = 54 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:27.868468', "invalid_after" = '2011-04-17 11:20:23.821739' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.6ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:27.874014', "invalid_after" = NULL WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 26)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:27.880405', "invalid_after" = '2011-04-19 11:20:23.821995' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:27.903353', "invalid_after" = '2011-04-20 11:20:23.822239' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.4ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (2.5ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.5ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:27.927292', "invalid_after" = NULL WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:27.953854', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:27.809886', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 116 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 26)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:27.960688', "invalid_after" = '2011-04-18 11:20:23.821346' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.4ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.6ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:27.966537', "invalid_after" = '2011-04-17 11:20:23.821739' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:27.972256', "invalid_after" = NULL WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 26)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  RoleAssignment Update (0.5ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:27.978782', "invalid_after" = '2011-04-19 11:20:23.821995' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.002184', "invalid_after" = '2011-04-20 11:20:23.822239' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.5ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.5ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.075841', "invalid_after" = NULL WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 116 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(26) SQL (1.2ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:28.135341', 'f', NULL, NULL, '2011-04-18 11:20:28.135341', 26, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.142668', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:28.135341', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 117 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.153841', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:28.135341', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 117 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.156909', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:28.135341', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = 3 WHERE "id" = 117 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.167408', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:28.135341', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 117 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.170800', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:28.135341', "target_name" = NULL, "is_grant" = 't', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 117 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.180889', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:28.135341', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 117 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.183929', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:28.135341', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'any', "target_owner_firm_id" = 3 WHERE "id" = 117 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 26)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.191308', "invalid_after" = '2011-04-18 11:20:23.821346' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.197186', "invalid_after" = '2011-04-17 11:20:23.821739' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.202384', "invalid_after" = NULL WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 26)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.209003', "invalid_after" = '2011-04-19 11:20:23.821995' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.232053', "invalid_after" = '2011-04-20 11:20:23.822239' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.4ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.7ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.256629', "invalid_after" = NULL WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.7ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.286161', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:28.135341', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 117 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 26)) LIMIT 1 SQL (0.3ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.293270', "invalid_after" = '2011-04-18 11:20:23.821346' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.298442', "invalid_after" = '2011-04-17 11:20:23.821739' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.302977', "invalid_after" = NULL WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 26)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.308466', "invalid_after" = '2011-04-19 11:20:23.821995' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.1ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.1ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.330114', "invalid_after" = '2011-04-20 11:20:23.822239' WHERE "id" = 54 SQL (0.3ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.1ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.6ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.352244', "invalid_after" = NULL WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.4ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.5ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.4ms) DELETE FROM "permissions" WHERE "id" = 117 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.4ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(26) SQL (1.5ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:28.395418', 't', NULL, NULL, '2011-04-18 11:20:28.395418', 26, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.402615', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:20:28.395418', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 118 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.411913', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:20:28.395418', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 118 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.414794', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:20:28.395418', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 118 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.424331', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:20:28.395418', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 118 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.427217', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:20:28.395418', "target_name" = NULL, "is_grant" = 't', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 118 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.436194', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:20:28.395418', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 118 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.439441', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:20:28.395418', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'any', "target_owner_firm_id" = NULL WHERE "id" = 118 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 26)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.445439', "invalid_after" = '2011-04-18 11:20:23.821346' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.452627', "invalid_after" = '2011-04-17 11:20:23.821739' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.458156', "invalid_after" = NULL WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 26)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  RoleAssignment Update (0.6ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.464781', "invalid_after" = '2011-04-19 11:20:23.821995' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.6ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.5ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.484810', "invalid_after" = '2011-04-20 11:20:23.822239' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.6ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.504107', "invalid_after" = NULL WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.4ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.525443', "target_owned_by_self" = 't', "created_at" = '2011-04-18 11:20:28.395418', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 118 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 26)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.532109', "invalid_after" = '2011-04-18 11:20:23.821346' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.7ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.537248', "invalid_after" = '2011-04-17 11:20:23.821739' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.543100', "invalid_after" = NULL WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 26)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.549965', "invalid_after" = '2011-04-19 11:20:23.821995' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.6ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.5ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.570097', "invalid_after" = '2011-04-20 11:20:23.822239' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.4ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.589691', "invalid_after" = NULL WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 118 SQL (0.3ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(26) SQL (1.5ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:28.692494', 'f', 1, 'mertz family blog', '2011-04-18 11:20:28.692494', 26, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.700482', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:28.692494', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 119 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.710439', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:28.692494', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 119 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.7ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.713573', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:28.692494', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 119 SQL (1.6ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.724892', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:28.692494', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 119 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.728015', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:28.692494', "target_name" = 'mertz family blog', "is_grant" = 't', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 119 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.737742', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:28.692494', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 119 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.740832', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:28.692494', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'any', "target_owner_firm_id" = NULL WHERE "id" = 119 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 26)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.747804', "invalid_after" = '2011-04-18 11:20:23.821346' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.754256', "invalid_after" = '2011-04-17 11:20:23.821739' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.760218', "invalid_after" = NULL WHERE "id" = 54 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 26)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.766388', "invalid_after" = '2011-04-19 11:20:23.821995' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.4ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.5ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.789776', "invalid_after" = '2011-04-20 11:20:23.822239' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.1ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.813225', "invalid_after" = NULL WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 26, "updated_at" = '2011-04-18 11:20:28.840152', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:28.692494', "target_name" = 'mertz family blog', "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 119 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 26)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.847045', "invalid_after" = '2011-04-18 11:20:23.821346' WHERE "id" = 54 SQL (0.3ms) RELEASE SAVEPOINT active_record_1 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.7ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.852979', "invalid_after" = '2011-04-17 11:20:23.821739' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.6ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.858833', "invalid_after" = NULL WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 26)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.865418', "invalid_after" = '2011-04-19 11:20:23.821995' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.7ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.5ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.7ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.889992', "invalid_after" = '2011-04-20 11:20:23.822239' WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.6ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.6ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:28.913319', "invalid_after" = NULL WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.4ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 119 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(26) SQL (1.2ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:28.947780', 'f', NULL, NULL, '2011-04-18 11:20:28.947780', 26, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(26) SQL (1.2ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:28.955838', 'f', NULL, NULL, '2011-04-18 11:20:28.955838', 26, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 120 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 121 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(26) SQL (1.4ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.006627', 'f', NULL, NULL, '2011-04-18 11:20:29.006627', 26, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(26) SQL (1.2ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.014423', 't', NULL, NULL, '2011-04-18 11:20:29.014423', 26, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.6ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 122 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 123 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(26) SQL (1.2ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.058348', 'f', NULL, NULL, '2011-04-18 11:20:29.058348', 26, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(26) SQL (1.2ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.066154', 'f', 1, 'mertz family blog', '2011-04-18 11:20:29.066154', 26, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.5ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.5ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 124 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 125 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(26) SQL (1.3ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.116297', 'f', NULL, NULL, '2011-04-18 11:20:29.116297', 26, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(26) SQL (1.2ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.123621', 'f', NULL, NULL, '2011-04-18 11:20:29.123621', 26, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 126 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 127 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(26) SQL (1.4ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.173336', 'f', NULL, NULL, '2011-04-18 11:20:29.173336', 26, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(26) SQL (1.1ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.180815', 't', NULL, NULL, '2011-04-18 11:20:29.180815', 26, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.1ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.4ms) DELETE FROM "permissions" WHERE "id" = 128 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 129 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(26) SQL (1.5ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.220316', 'f', NULL, NULL, '2011-04-18 11:20:29.220316', 26, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(26) SQL (1.7ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.228379', 'f', 1, 'mertz family blog', '2011-04-18 11:20:29.228379', 26, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.5ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.2ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.4ms) DELETE FROM "permissions" WHERE "id" = 130 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.2ms) DELETE FROM "permissions" WHERE "id" = 131 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(26) SQL (1.1ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.340100', 't', NULL, NULL, '2011-04-18 11:20:29.340100', 26, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(26) SQL (1.4ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.347674', 'f', NULL, NULL, '2011-04-18 11:20:29.347674', 26, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 132 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.2ms) DELETE FROM "permissions" WHERE "id" = 133 SQL (0.4ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(26) SQL (1.2ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.387442', 't', NULL, NULL, '2011-04-18 11:20:29.387442', 26, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(26) SQL (1.2ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.394486', 'f', NULL, NULL, '2011-04-18 11:20:29.394486', 26, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 134 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.2ms) DELETE FROM "permissions" WHERE "id" = 135 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(26) SQL (1.7ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.433864', 't', NULL, NULL, '2011-04-18 11:20:29.433864', 26, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(26) SQL (1.9ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.444785', 'f', 1, 'mertz family blog', '2011-04-18 11:20:29.444785', 26, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.5ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (2.0ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.5ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 136 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.2ms) DELETE FROM "permissions" WHERE "id" = 137 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(26) SQL (1.2ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.496423', 'f', 1, 'mertz family blog', '2011-04-18 11:20:29.496423', 26, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(26) SQL (1.1ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.503653', 'f', NULL, NULL, '2011-04-18 11:20:29.503653', 26, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 138 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.2ms) DELETE FROM "permissions" WHERE "id" = 139 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(26) SQL (1.1ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.547404', 'f', 1, 'mertz family blog', '2011-04-18 11:20:29.547404', 26, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(26) SQL (1.1ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.554242', 'f', NULL, NULL, '2011-04-18 11:20:29.554242', 26, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 140 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.2ms) DELETE FROM "permissions" WHERE "id" = 141 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(26) SQL (1.2ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.601341', 'f', 1, 'mertz family blog', '2011-04-18 11:20:29.601341', 26, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(26) SQL (1.1ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.608132', 't', NULL, NULL, '2011-04-18 11:20:29.608132', 26, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.3ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 142 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(26) Permission Destroy (0.2ms) DELETE FROM "permissions" WHERE "id" = 143 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(26) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 26 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 55 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 54 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.5ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.3ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.5ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:29.674274', '2011-04-18 11:20:29.674274', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(27) SQL (2.0ms) select 'x' from roles where id = 27 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.7ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:29.688578', '2011-04-18 11:20:29.688578', 27, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.5ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.6ms) SELECT count(*) AS count_all FROM "users" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'frammis' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 5) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.8ms) select 'x' from roles where id = 27 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 27)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('User', 't', '2011-04-18 11:20:29.706708', NULL, NULL, '2011-04-18 11:20:29.706708', 27, NULL, 'any', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.7ms) SELECT count(*) AS count_all FROM "users" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'frammis' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 5) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) ) )  User Load (2.1ms) SELECT * FROM "users" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'frammis' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 5) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(27) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 27 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 56 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN Blog Load (0.4ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.5ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.5ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:29.759052', '2011-04-18 11:20:29.759052', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(28) SQL (2.0ms) select 'x' from roles where id = 28 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.7ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:29.773781', '2011-04-18 11:20:29.773781', 28, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.8ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: edit Role twiddler(3) === permission check: edit Role test role(28) SQL (2.0ms) select 'x' from roles where id = 28 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Role', '2011-04-18 11:20:29.791332', 'f', 3, 'twiddler', '2011-04-18 11:20:29.791332', 28, NULL, 'edit', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role twiddler(3) SQL (1.8ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(28) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 28 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 57 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 Role Load (0.5ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.6ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:29.824449', '2011-04-18 11:20:29.824449', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(29) SQL (1.8ms) select 'x' from roles where id = 29 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.6ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:29.838583', '2011-04-18 11:20:29.838583', 29, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.5ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.8ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.2ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.2ms) ROLLBACK TO SAVEPOINT active_record_1 === permission check: edit Role test role(29) SQL (1.8ms) select 'x' from roles where id = 29 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.858407', 'f', NULL, NULL, '2011-04-18 11:20:29.858407', 29, NULL, 'post', 'f', 't', 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:29.865988', 'f', NULL, NULL, '2011-04-18 11:20:29.865988', 3, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(29) Role Destroy (0.5ms) DELETE FROM "roles" WHERE "id" = 29 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 58 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.6ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.5ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.6ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.5ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:29.894408', '2011-04-18 11:20:29.894408', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(30) SQL (1.8ms) select 'x' from roles where id = 30 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.7ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:29.908408', '2011-04-18 11:20:29.908408', 30, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.5ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.8ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.3ms) SAVEPOINT active_record_1 === FAILED permission check: edit Role twiddler(3) SQL (0.2ms) ROLLBACK TO SAVEPOINT active_record_1 === permission check: edit Role test role(30) SQL (1.8ms) select 'x' from roles where id = 30 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Role', '2011-04-18 11:20:29.927457', 'f', 3, 'twiddler', '2011-04-18 11:20:29.927457', 30, NULL, 'edit', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role twiddler(3) Permission Destroy (0.4ms) DELETE FROM "permissions" WHERE "id" = 147 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(30) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 30 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 59 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.6ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 3 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 1)  Permission Load (0.3ms) SELECT * FROM "permissions" WHERE ("permissions".role_id = 1)  Role Load (0.2ms) SELECT * FROM "roles" WHERE ("roles"."id" = 2)  Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions".role_id = 2)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.1ms) select 'x' from roles where id = 1 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from roles where id = 1 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.2ms) SELECT * FROM "roles" WHERE ("roles"."id" = 1)  SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.036994', '2011-04-18 11:20:30.036994', 1, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 2 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from roles where id = 2 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.9ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 2)  SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.052611', '2011-04-18 11:20:30.052611', 2, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 1)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 1)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:30.062655', "invalid_after" = '2011-04-19 11:20:23.821995' WHERE "id" = 60 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:30.069610', "invalid_after" = '2011-04-20 11:20:23.822239' WHERE "id" = 60 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:30.077063', "invalid_after" = NULL WHERE "id" = 60 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 1)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 1)  RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:30.088398', "invalid_after" = '2011-04-18 11:20:23.821346' WHERE "id" = 60 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.3ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:30.095481', "invalid_after" = '2011-04-17 11:20:23.821739' WHERE "id" = 60 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.8ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.5ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:20:30.104440', "invalid_after" = NULL WHERE "id" = 60 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN Blog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  PhonyPatBlog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Blog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 3)  PhonyPatBlog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 3)  Blog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 4)  PhonyPatBlog Load (0.2ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 4)  Blog Load (0.2ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 5)  PhonyPatBlog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 5)  Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:30.128993', '2011-04-18 11:20:30.128993', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(31) SQL (1.1ms) select 'x' from roles where id = 31 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.138056', '2011-04-18 11:20:30.138056', 31, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(31) SQL (1.1ms) select 'x' from roles where id = 31 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:30.146649', 'f', 2, 'Dubuque', '2011-04-18 11:20:30.146649', 31, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(31) SQL (1.1ms) select 'x' from roles where id = 31 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatBlog', '2011-04-18 11:20:30.154155', 'f', 3, 'ricky''s dubuque blog', '2011-04-18 11:20:30.154155', 31, NULL, 'add_post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(31) SQL (1.1ms) select 'x' from roles where id = 31 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatEntry', '2011-04-18 11:20:30.161023', 'f', NULL, NULL, '2011-04-18 11:20:30.161023', 31, NULL, 'create', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  === permission check: blog_within_firm Firm Dubuque(2) SQL (1.0ms) select 'x' from firms where id = 2 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'blog_within_firm' or p.privilege = 'any') and (p.class_name = 'Firm') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or 2 + 2 = 5) and (p.target_id is null or firms.id = p.target_id) )  === permission check: add_post PhonyPatBlog ricky's dubuque blog(3) SQL (1.1ms) select 'x' from blogs where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'add_post' or p.privilege = 'any') and (p.class_name = 'PhonyPatBlog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: create PhonyPatEntry X() SQL (1.0ms) INSERT INTO "blog_entries" ("created_at", "updated_at", "blog_id", "owner_id", "owner_firm_id", "entry_txt") VALUES('2011-04-18 11:20:30.176292', '2011-04-18 11:20:30.176292', 3, 4, 2, 'hello') RETURNING "id" SQL (0.4ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(31) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 31 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 62 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:30.198912', '2011-04-18 11:20:30.198912', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(32) SQL (1.1ms) select 'x' from roles where id = 32 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.207436', '2011-04-18 11:20:30.207436', 32, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(32) SQL (1.2ms) select 'x' from roles where id = 32 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatBlog', '2011-04-18 11:20:30.215666', 'f', NULL, NULL, '2011-04-18 11:20:30.215666', 32, 2, 'add_post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  PhonyPatBlog Load (1.1ms) SELECT * FROM "blogs" WHERE (id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'add_post' or p.privilege = 'any') and (p.class_name = 'PhonyPatBlog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(32) Role Destroy (0.2ms) DELETE FROM "roles" WHERE "id" = 32 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 63 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:30.235672', '2011-04-18 11:20:30.235672', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(33) SQL (1.1ms) select 'x' from roles where id = 33 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.244544', '2011-04-18 11:20:30.244544', 33, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(33) SQL (1.1ms) select 'x' from roles where id = 33 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatBlog', '2011-04-18 11:20:30.252925', 'f', NULL, NULL, '2011-04-18 11:20:30.252925', 33, 2, 'add_post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(33) SQL (1.1ms) select 'x' from roles where id = 33 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatBlog', '2011-04-18 11:20:30.259549', 'f', 3, 'ricky''s dubuque blog', '2011-04-18 11:20:30.259549', 33, NULL, 'kill_post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  PhonyPatBlog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."owner_firm_id" = 2)  PhonyPatBlog Load (1.1ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'add_post' or p.privilege = 'any') and (p.class_name = 'PhonyPatBlog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(33) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 33 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 64 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) ROLLBACK SQL (0.1ms) BEGIN Blog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  PhonyPatBlog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Blog Load (0.2ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 3)  PhonyPatBlog Load (0.2ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 3)  Blog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 4)  PhonyPatBlog Load (0.2ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 4)  Blog Load (0.2ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 5)  PhonyPatBlog Load (0.2ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 5)  Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:30.295955', '2011-04-18 11:20:30.295955', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(34) SQL (1.1ms) select 'x' from roles where id = 34 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.305026', '2011-04-18 11:20:30.305026', 34, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(34) SQL (1.2ms) select 'x' from roles where id = 34 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:30.313664', 'f', 2, 'Dubuque', '2011-04-18 11:20:30.313664', 34, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(34) SQL (1.1ms) select 'x' from roles where id = 34 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatBlog', '2011-04-18 11:20:30.320451', 'f', 3, 'ricky''s dubuque blog', '2011-04-18 11:20:30.320451', 34, NULL, 'add_post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(34) SQL (1.3ms) select 'x' from roles where id = 34 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatEntry', '2011-04-18 11:20:30.327569', 'f', NULL, NULL, '2011-04-18 11:20:30.327569', 34, NULL, 'create', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  === permission check: blog_within_firm Firm Dubuque(2) SQL (0.9ms) select 'x' from firms where id = 2 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'blog_within_firm' or p.privilege = 'any') and (p.class_name = 'Firm') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or 2 + 2 = 5) and (p.target_id is null or firms.id = p.target_id) )  === permission check: add_post PhonyPatBlog ricky's dubuque blog(3) SQL (1.1ms) select 'x' from blogs where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'add_post' or p.privilege = 'any') and (p.class_name = 'PhonyPatBlog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: create PhonyPatEntry X() SQL (0.4ms) INSERT INTO "blog_entries" ("created_at", "updated_at", "blog_id", "owner_id", "owner_firm_id", "entry_txt") VALUES('2011-04-18 11:20:30.339553', '2011-04-18 11:20:30.339553', 3, 4, 2, 'hello') RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(34) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 34 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 65 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 1)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:30.359189', '2011-04-18 11:20:30.359189', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(35) SQL (1.4ms) select 'x' from roles where id = 35 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.368326', '2011-04-18 11:20:30.368326', 35, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(35) SQL (1.1ms) select 'x' from roles where id = 35 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:30.376612', 'f', 2, 'Dubuque', '2011-04-18 11:20:30.376612', 35, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Firm Load (0.8ms) SELECT * FROM "firms" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'blog_within_firm' or p.privilege = 'any') and (p.class_name = 'Firm') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or 2 + 2 = 5) and (p.target_id is null or firms.id = p.target_id) ) and 2 + 2 = 5)  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(35) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 35 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 66 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:30.396452', '2011-04-18 11:20:30.396452', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(36) SQL (1.1ms) select 'x' from roles where id = 36 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.405088', '2011-04-18 11:20:30.405088', 36, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(36) SQL (1.1ms) select 'x' from roles where id = 36 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatEntry', '2011-04-18 11:20:30.413235', 'f', NULL, NULL, '2011-04-18 11:20:30.413235', 36, 2, 'create', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Firm Load (1.1ms) SELECT * FROM "firms" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'blog_within_firm' or p.privilege = 'any') and (p.class_name = 'Firm') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or 2 + 2 = 5) and (p.target_id is null or firms.id = p.target_id) ) and firms.id in (2))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(36) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 36 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 67 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:30.433887', '2011-04-18 11:20:30.433887', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(37) SQL (1.1ms) select 'x' from roles where id = 37 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.6ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.444749', '2011-04-18 11:20:30.444749', 37, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(37) SQL (1.1ms) select 'x' from roles where id = 37 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:30.453310', 'f', 2, 'Dubuque', '2011-04-18 11:20:30.453310', 37, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(37) SQL (1.1ms) select 'x' from roles where id = 37 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatEntry', '2011-04-18 11:20:30.459958', 'f', NULL, NULL, '2011-04-18 11:20:30.459958', 37, 2, 'update', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Firm Load (0.8ms) SELECT * FROM "firms" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'blog_within_firm' or p.privilege = 'any') and (p.class_name = 'Firm') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or 2 + 2 = 5) and (p.target_id is null or firms.id = p.target_id) ) and 2 + 2 = 5)  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(37) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 37 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 68 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:30.479568', '2011-04-18 11:20:30.479568', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(38) SQL (1.1ms) select 'x' from roles where id = 38 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.488359', '2011-04-18 11:20:30.488359', 38, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(38) SQL (1.1ms) select 'x' from roles where id = 38 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:30.557215', 'f', 2, 'Dubuque', '2011-04-18 11:20:30.557215', 38, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(38) SQL (1.1ms) select 'x' from roles where id = 38 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatEntry', '2011-04-18 11:20:30.564372', 'f', NULL, NULL, '2011-04-18 11:20:30.564372', 38, 2, 'create', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Firm Load (1.8ms) SELECT * FROM "firms" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'blog_within_firm' or p.privilege = 'any') and (p.class_name = 'Firm') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or 2 + 2 = 5) and (p.target_id is null or firms.id = p.target_id) ) and firms.id in (2))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(38) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 38 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 69 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:30.586861', '2011-04-18 11:20:30.586861', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(39) SQL (1.1ms) select 'x' from roles where id = 39 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.595748', '2011-04-18 11:20:30.595748', 39, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(39) SQL (1.1ms) select 'x' from roles where id = 39 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.6ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:30.604850', 'f', 2, 'Dubuque', '2011-04-18 11:20:30.604850', 39, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(39) SQL (1.1ms) select 'x' from roles where id = 39 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatEntry', '2011-04-18 11:20:30.611968', 'f', NULL, NULL, '2011-04-18 11:20:30.611968', 39, 2, 'create', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(39) SQL (1.1ms) select 'x' from roles where id = 39 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:30.618647', 'f', 1, 'Shire', '2011-04-18 11:20:30.618647', 39, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Firm Load (1.0ms) SELECT * FROM "firms" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'blog_within_firm' or p.privilege = 'any') and (p.class_name = 'Firm') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or 2 + 2 = 5) and (p.target_id is null or firms.id = p.target_id) ) and firms.id in (2))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(39) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 39 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 70 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:30.639297', '2011-04-18 11:20:30.639297', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(40) SQL (1.3ms) select 'x' from roles where id = 40 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.648458', '2011-04-18 11:20:30.648458', 40, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(40) SQL (1.1ms) select 'x' from roles where id = 40 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:30.659305', 'f', 2, 'Dubuque', '2011-04-18 11:20:30.659305', 40, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(40) SQL (1.1ms) select 'x' from roles where id = 40 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatEntry', '2011-04-18 11:20:30.666369', 'f', NULL, NULL, '2011-04-18 11:20:30.666369', 40, 2, 'create', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(40) SQL (1.1ms) select 'x' from roles where id = 40 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:30.673055', 'f', 1, 'Shire', '2011-04-18 11:20:30.673055', 40, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(40) SQL (1.1ms) select 'x' from roles where id = 40 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatEntry', '2011-04-18 11:20:30.679838', 'f', NULL, NULL, '2011-04-18 11:20:30.679838', 40, 1, 'create', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Firm Load (1.1ms) SELECT * FROM "firms" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'blog_within_firm' or p.privilege = 'any') and (p.class_name = 'Firm') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or 2 + 2 = 5) and (p.target_id is null or firms.id = p.target_id) ) and firms.id in (1,2))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(40) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 40 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 71 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN Blog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  PhonyPatBlog Load (0.4ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Blog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 3)  PhonyPatBlog Load (0.2ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 3)  Blog Load (0.2ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 4)  PhonyPatBlog Load (0.2ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 4)  Blog Load (0.2ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 5)  PhonyPatBlog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 5)  Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:30.714962', '2011-04-18 11:20:30.714962', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(41) SQL (1.1ms) select 'x' from roles where id = 41 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.4ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.724364', '2011-04-18 11:20:30.724364', 41, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(41) SQL (1.1ms) select 'x' from roles where id = 41 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:30.733149', 'f', 2, 'Dubuque', '2011-04-18 11:20:30.733149', 41, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(41) SQL (1.1ms) select 'x' from roles where id = 41 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatBlog', '2011-04-18 11:20:30.739898', 'f', 3, 'ricky''s dubuque blog', '2011-04-18 11:20:30.739898', 41, NULL, 'add_post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(41) SQL (1.1ms) select 'x' from roles where id = 41 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatEntry', '2011-04-18 11:20:30.746636', 'f', NULL, NULL, '2011-04-18 11:20:30.746636', 41, NULL, 'create', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  === permission check: blog_within_firm Firm Dubuque(2) SQL (1.0ms) select 'x' from firms where id = 2 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'blog_within_firm' or p.privilege = 'any') and (p.class_name = 'Firm') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or 2 + 2 = 5) and (p.target_id is null or firms.id = p.target_id) )  === permission check: add_post PhonyPatBlog ricky's dubuque blog(3) SQL (1.1ms) select 'x' from blogs where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'add_post' or p.privilege = 'any') and (p.class_name = 'PhonyPatBlog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: create PhonyPatEntry X() SQL (0.3ms) INSERT INTO "blog_entries" ("created_at", "updated_at", "blog_id", "owner_id", "owner_firm_id", "entry_txt") VALUES('2011-04-18 11:20:30.759323', '2011-04-18 11:20:30.759323', 3, 4, 2, 'hello') RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(41) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 41 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 72 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 1)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:30.778721', '2011-04-18 11:20:30.778721', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(42) SQL (1.5ms) select 'x' from roles where id = 42 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.787936', '2011-04-18 11:20:30.787936', 42, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(42) SQL (1.1ms) select 'x' from roles where id = 42 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:30.796266', 'f', 2, 'Dubuque', '2011-04-18 11:20:30.796266', 42, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Firm Load (0.8ms) SELECT * FROM "firms" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'blog_within_firm' or p.privilege = 'any') and (p.class_name = 'Firm') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or 2 + 2 = 5) and (p.target_id is null or firms.id = p.target_id) ) and 2 + 2 = 5)  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(42) Role Destroy (0.2ms) DELETE FROM "roles" WHERE "id" = 42 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 73 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:30.816096', '2011-04-18 11:20:30.816096', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(43) SQL (1.1ms) select 'x' from roles where id = 43 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.824769', '2011-04-18 11:20:30.824769', 43, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(43) SQL (1.1ms) select 'x' from roles where id = 43 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatEntry', '2011-04-18 11:20:30.833138', 'f', NULL, NULL, '2011-04-18 11:20:30.833138', 43, 2, 'update', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Firm Load (1.0ms) SELECT * FROM "firms" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'blog_within_firm' or p.privilege = 'any') and (p.class_name = 'Firm') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or 2 + 2 = 5) and (p.target_id is null or firms.id = p.target_id) ) and firms.id in (2))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(43) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 43 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.5ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 74 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:30.852799', '2011-04-18 11:20:30.852799', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(44) SQL (1.1ms) select 'x' from roles where id = 44 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.861544', '2011-04-18 11:20:30.861544', 44, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(44) SQL (1.1ms) select 'x' from roles where id = 44 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:30.869843', 'f', 2, 'Dubuque', '2011-04-18 11:20:30.869843', 44, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(44) SQL (1.1ms) select 'x' from roles where id = 44 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatEntry', '2011-04-18 11:20:30.876432', 'f', NULL, NULL, '2011-04-18 11:20:30.876432', 44, 2, 'create', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Firm Load (0.8ms) SELECT * FROM "firms" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'blog_within_firm' or p.privilege = 'any') and (p.class_name = 'Firm') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or 2 + 2 = 5) and (p.target_id is null or firms.id = p.target_id) ) and 2 + 2 = 5)  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(44) Role Destroy (0.2ms) DELETE FROM "roles" WHERE "id" = 44 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 75 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:30.895698', '2011-04-18 11:20:30.895698', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(45) SQL (1.1ms) select 'x' from roles where id = 45 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.904334', '2011-04-18 11:20:30.904334', 45, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(45) SQL (1.1ms) select 'x' from roles where id = 45 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:30.912544', 'f', 2, 'Dubuque', '2011-04-18 11:20:30.912544', 45, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(45) SQL (1.1ms) select 'x' from roles where id = 45 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatEntry', '2011-04-18 11:20:30.919139', 'f', NULL, NULL, '2011-04-18 11:20:30.919139', 45, 2, 'update', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Firm Load (1.0ms) SELECT * FROM "firms" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'blog_within_firm' or p.privilege = 'any') and (p.class_name = 'Firm') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or 2 + 2 = 5) and (p.target_id is null or firms.id = p.target_id) ) and firms.id in (2))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(45) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 45 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 76 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.5ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:30.939014', '2011-04-18 11:20:30.939014', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(46) SQL (1.1ms) select 'x' from roles where id = 46 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.948215', '2011-04-18 11:20:30.948215', 46, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(46) SQL (1.1ms) select 'x' from roles where id = 46 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:30.956419', 'f', 2, 'Dubuque', '2011-04-18 11:20:30.956419', 46, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(46) SQL (1.1ms) select 'x' from roles where id = 46 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatEntry', '2011-04-18 11:20:30.963753', 'f', NULL, NULL, '2011-04-18 11:20:30.963753', 46, 2, 'update', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(46) SQL (1.1ms) select 'x' from roles where id = 46 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:30.970442', 'f', 1, 'Shire', '2011-04-18 11:20:30.970442', 46, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Firm Load (1.0ms) SELECT * FROM "firms" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'blog_within_firm' or p.privilege = 'any') and (p.class_name = 'Firm') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or 2 + 2 = 5) and (p.target_id is null or firms.id = p.target_id) ) and firms.id in (2))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(46) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 46 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 77 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:30.990556', '2011-04-18 11:20:30.990556', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(47) SQL (1.1ms) select 'x' from roles where id = 47 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.4ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:30.999558', '2011-04-18 11:20:30.999558', 47, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(47) SQL (1.7ms) select 'x' from roles where id = 47 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:31.011612', 'f', 2, 'Dubuque', '2011-04-18 11:20:31.011612', 47, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(47) SQL (1.8ms) select 'x' from roles where id = 47 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatEntry', '2011-04-18 11:20:31.022879', 'f', NULL, NULL, '2011-04-18 11:20:31.022879', 47, 2, 'update', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(47) SQL (1.8ms) select 'x' from roles where id = 47 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:31.033783', 'f', 1, 'Shire', '2011-04-18 11:20:31.033783', 47, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(47) SQL (1.8ms) select 'x' from roles where id = 47 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatEntry', '2011-04-18 11:20:31.044625', 'f', NULL, NULL, '2011-04-18 11:20:31.044625', 47, 1, 'update', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Firm Load (1.7ms) SELECT * FROM "firms" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'blog_within_firm' or p.privilege = 'any') and (p.class_name = 'Firm') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or 2 + 2 = 5) and (p.target_id is null or firms.id = p.target_id) ) and firms.id in (1,2))  SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(47) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 47 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 78 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN Blog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  PhonyPatBlog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Blog Load (0.2ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 3)  PhonyPatBlog Load (0.2ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 3)  Blog Load (0.2ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 4)  PhonyPatBlog Load (0.2ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 4)  Blog Load (0.2ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 5)  PhonyPatBlog Load (0.5ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 5)  Firm Load (0.9ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:31.153797', '2011-04-18 11:20:31.153797', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(48) SQL (1.2ms) select 'x' from roles where id = 48 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:31.163654', '2011-04-18 11:20:31.163654', 48, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(48) SQL (1.1ms) select 'x' from roles where id = 48 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Firm', '2011-04-18 11:20:31.172344', 'f', 2, 'Dubuque', '2011-04-18 11:20:31.172344', 48, NULL, 'blog_within_firm', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(48) SQL (1.2ms) select 'x' from roles where id = 48 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatBlog', '2011-04-18 11:20:31.179457', 'f', 3, 'ricky''s dubuque blog', '2011-04-18 11:20:31.179457', 48, NULL, 'add_post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(48) SQL (1.1ms) select 'x' from roles where id = 48 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyPatEntry', '2011-04-18 11:20:31.186366', 'f', NULL, NULL, '2011-04-18 11:20:31.186366', 48, NULL, 'create', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  === permission check: blog_within_firm Firm Dubuque(2) SQL (0.9ms) select 'x' from firms where id = 2 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'blog_within_firm' or p.privilege = 'any') and (p.class_name = 'Firm') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or 2 + 2 = 5) and (p.target_id is null or firms.id = p.target_id) )  === permission check: add_post PhonyPatBlog ricky's dubuque blog(3) SQL (1.1ms) select 'x' from blogs where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'add_post' or p.privilege = 'any') and (p.class_name = 'PhonyPatBlog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: create PhonyPatEntry X() SQL (0.3ms) INSERT INTO "blog_entries" ("created_at", "updated_at", "blog_id", "owner_id", "owner_firm_id", "entry_txt") VALUES('2011-04-18 11:20:31.198594', '2011-04-18 11:20:31.198594', 3, 4, 2, 'hello') RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(48) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 48 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 79 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Firm Load (0.2ms) SELECT * FROM "firms"  Firm Load (0.2ms) SELECT * FROM "firms"  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN Blog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:31.222902', '2011-04-18 11:20:31.222902', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(49) SQL (1.1ms) select 'x' from roles where id = 49 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:31.231777', '2011-04-18 11:20:31.231777', 49, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 2)  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 4)  === FAILED permission check: change_post Blog mertz family blog(1) === permission check: edit Role test role(49) SQL (1.2ms) select 'x' from roles where id = 49 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:31.248679', 'f', 1, 'mertz family blog', '2011-04-18 11:20:31.248679', 49, NULL, 'change_post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_post Blog mertz family blog(1) === permission check: change_post Blog mertz family blog(1) SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "blog_entries" ("created_at", "updated_at", "blog_id", "owner_id", "owner_firm_id", "entry_txt") VALUES('2011-04-18 11:20:31.256002', '2011-04-18 11:20:31.256002', 1, 2, 4, 'Mertz blog entry a') RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: change_post Blog mertz family blog(1) === permission check: change_post Blog mertz family blog(1) SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "blog_entries" ("created_at", "updated_at", "blog_id", "owner_id", "owner_firm_id", "entry_txt") VALUES('2011-04-18 11:20:31.265997', '2011-04-18 11:20:31.265997', 1, 2, 4, 'Mertz blog entry b') RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(49) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 49 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 80 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:31.284566', '2011-04-18 11:20:31.284566', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(50) SQL (1.1ms) select 'x' from roles where id = 50 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:31.293628', '2011-04-18 11:20:31.293628', 50, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: add_comment BlogEntry X(5) === permission check: edit Role test role(50) SQL (1.2ms) select 'x' from roles where id = 50 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('BlogEntry', '2011-04-18 11:20:31.307710', 'f', 5, NULL, '2011-04-18 11:20:31.307710', 50, NULL, 'add_comment', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: add_comment BlogEntry X(5) SQL (1.2ms) select 'x' from blog_entries where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'add_comment' or p.privilege = 'any') and (p.class_name = 'BlogEntry') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blog_entries.owner_id = 5) and (p.target_id is null or blog_entries.id = p.target_id) and (p.target_owner_id is null or blog_entries.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blog_entries.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.0ms) INSERT INTO "entry_comments" ("created_at", "updated_at", "comment_txt", "owner_id", "owner_firm_id", "blog_entry_id") VALUES('2011-04-18 11:20:31.315976', '2011-04-18 11:20:31.315976', 'this is a comment', 2, 4, 5) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(50) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 50 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 81 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:31.337985', '2011-04-18 11:20:31.337985', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(51) SQL (1.1ms) select 'x' from roles where id = 51 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:31.346925', '2011-04-18 11:20:31.346925', 51, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: kill_comment BlogEntry X(5) === permission check: edit Role test role(51) SQL (1.1ms) select 'x' from roles where id = 51 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('BlogEntry', '2011-04-18 11:20:31.357447', 'f', 5, NULL, '2011-04-18 11:20:31.357447', 51, NULL, 'kill_comment', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: kill_comment BlogEntry X(5) === FAILED permission check: add_comment BlogEntry X(6) Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  === permission check: edit Role test role(51) === permission check: edit Role twiddler(3) SQL (1.1ms) select 'x' from roles where id = 51 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:31.369467', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:31.357447', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 5, "class_name" = 'BlogEntry', "target_owner_id" = NULL, "privilege" = 'kill_comment', "target_owner_firm_id" = NULL WHERE "id" = 192 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(51) SQL (1.0ms) select 'x' from roles where id = 51 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('BlogEntry', '2011-04-18 11:20:31.375656', 'f', 6, NULL, '2011-04-18 11:20:31.375656', 51, NULL, 'add_comment', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === FAILED permission check: kill_comment BlogEntry X(5) === permission check: edit Role test role(51) === permission check: edit Role twiddler(3) SQL (1.1ms) select 'x' from roles where id = 51 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:31.386169', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:31.375656', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 6, "class_name" = 'BlogEntry', "target_owner_id" = NULL, "privilege" = 'add_comment', "target_owner_firm_id" = NULL WHERE "id" = 193 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role twiddler(3) === permission check: edit Role test role(51) SQL (1.1ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from roles where id = 51 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 51, "updated_at" = '2011-04-18 11:20:31.394527', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:31.357447', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 5, "class_name" = 'BlogEntry', "target_owner_id" = NULL, "privilege" = 'kill_comment', "target_owner_firm_id" = NULL WHERE "id" = 192 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role twiddler(3) === permission check: edit Role test role(51) SQL (1.1ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from roles where id = 51 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 51, "updated_at" = '2011-04-18 11:20:31.402828', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:31.375656', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 6, "class_name" = 'BlogEntry', "target_owner_id" = NULL, "privilege" = 'add_comment', "target_owner_firm_id" = NULL WHERE "id" = 193 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: kill_comment BlogEntry X(5) === permission check: add_comment BlogEntry X(6) SQL (1.1ms) select 'x' from blog_entries where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'kill_comment' or p.privilege = 'any') and (p.class_name = 'BlogEntry') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blog_entries.owner_id = 5) and (p.target_id is null or blog_entries.id = p.target_id) and (p.target_owner_id is null or blog_entries.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blog_entries.owner_firm_id = p.target_owner_firm_id) )  SQL (1.1ms) select 'x' from blog_entries where id = 6 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'add_comment' or p.privilege = 'any') and (p.class_name = 'BlogEntry') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blog_entries.owner_id = 5) and (p.target_id is null or blog_entries.id = p.target_id) and (p.target_owner_id is null or blog_entries.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blog_entries.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(51) Role Destroy (0.2ms) DELETE FROM "roles" WHERE "id" = 51 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 82 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:31.424465', '2011-04-18 11:20:31.424465', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(52) SQL (1.1ms) select 'x' from roles where id = 52 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:31.432929', '2011-04-18 11:20:31.432929', 52, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: kill_comment BlogEntry X(6) === permission check: edit Role test role(52) SQL (1.1ms) select 'x' from roles where id = 52 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('BlogEntry', '2011-04-18 11:20:31.443252', 'f', 6, NULL, '2011-04-18 11:20:31.443252', 52, NULL, 'kill_comment', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: kill_comment BlogEntry X(6) === FAILED permission check: add_comment BlogEntry X(5) === permission check: edit Role test role(52) === permission check: edit Role twiddler(3) SQL (1.1ms) select 'x' from roles where id = 52 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:31.454260', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:31.443252', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 6, "class_name" = 'BlogEntry', "target_owner_id" = NULL, "privilege" = 'kill_comment', "target_owner_firm_id" = NULL WHERE "id" = 194 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(52) SQL (1.1ms) select 'x' from roles where id = 52 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('BlogEntry', '2011-04-18 11:20:31.460582', 'f', 5, NULL, '2011-04-18 11:20:31.460582', 52, NULL, 'add_comment', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === FAILED permission check: kill_comment BlogEntry X(6) === permission check: edit Role test role(52) === permission check: edit Role twiddler(3) SQL (1.7ms) select 'x' from roles where id = 52 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.1ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:31.472993', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:31.460582', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 5, "class_name" = 'BlogEntry', "target_owner_id" = NULL, "privilege" = 'add_comment', "target_owner_firm_id" = NULL WHERE "id" = 195 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role twiddler(3) === permission check: edit Role test role(52) SQL (1.1ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.5ms) select 'x' from roles where id = 52 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 52, "updated_at" = '2011-04-18 11:20:31.481979', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:31.443252', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 6, "class_name" = 'BlogEntry', "target_owner_id" = NULL, "privilege" = 'kill_comment', "target_owner_firm_id" = NULL WHERE "id" = 194 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role twiddler(3) === permission check: edit Role test role(52) SQL (1.1ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from roles where id = 52 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 52, "updated_at" = '2011-04-18 11:20:31.490290', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:31.460582', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 5, "class_name" = 'BlogEntry', "target_owner_id" = NULL, "privilege" = 'add_comment', "target_owner_firm_id" = NULL WHERE "id" = 195 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: kill_comment BlogEntry X(6) === permission check: add_comment BlogEntry X(5) SQL (1.1ms) select 'x' from blog_entries where id = 6 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'kill_comment' or p.privilege = 'any') and (p.class_name = 'BlogEntry') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blog_entries.owner_id = 5) and (p.target_id is null or blog_entries.id = p.target_id) and (p.target_owner_id is null or blog_entries.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blog_entries.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from blog_entries where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'add_comment' or p.privilege = 'any') and (p.class_name = 'BlogEntry') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blog_entries.owner_id = 5) and (p.target_id is null or blog_entries.id = p.target_id) and (p.target_owner_id is null or blog_entries.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blog_entries.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(52) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 52 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 83 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:31.513770', '2011-04-18 11:20:31.513770', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(53) SQL (1.1ms) select 'x' from roles where id = 53 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:31.522247', '2011-04-18 11:20:31.522247', 53, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (1.1ms) select 'x' from blog_entries where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'kill_comment' or p.privilege = 'any') and (p.class_name = 'BlogEntry') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blog_entries.owner_id = 5) and (p.target_id is null or blog_entries.id = p.target_id) and (p.target_owner_id is null or blog_entries.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blog_entries.owner_firm_id = p.target_owner_firm_id) )  === permission check: edit Role test role(53) SQL (1.1ms) select 'x' from roles where id = 53 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('BlogEntry', '2011-04-18 11:20:31.534369', 'f', 5, NULL, '2011-04-18 11:20:31.534369', 53, NULL, 'kill_comment', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.0ms) select 'x' from blog_entries where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'kill_comment' or p.privilege = 'any') and (p.class_name = 'BlogEntry') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blog_entries.owner_id = 5) and (p.target_id is null or blog_entries.id = p.target_id) and (p.target_owner_id is null or blog_entries.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blog_entries.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from blog_entries where id = 6 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'add_comment' or p.privilege = 'any') and (p.class_name = 'BlogEntry') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blog_entries.owner_id = 5) and (p.target_id is null or blog_entries.id = p.target_id) and (p.target_owner_id is null or blog_entries.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blog_entries.owner_firm_id = p.target_owner_firm_id) )  === permission check: edit Role test role(53) === permission check: edit Role twiddler(3) SQL (1.1ms) select 'x' from roles where id = 53 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:31.548181', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:31.534369', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 5, "class_name" = 'BlogEntry', "target_owner_id" = NULL, "privilege" = 'kill_comment', "target_owner_firm_id" = NULL WHERE "id" = 196 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(53) SQL (1.0ms) select 'x' from roles where id = 53 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('BlogEntry', '2011-04-18 11:20:31.554313', 'f', 6, NULL, '2011-04-18 11:20:31.554313', 53, NULL, 'add_comment', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) select 'x' from blog_entries where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'kill_comment' or p.privilege = 'any') and (p.class_name = 'BlogEntry') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blog_entries.owner_id = 5) and (p.target_id is null or blog_entries.id = p.target_id) and (p.target_owner_id is null or blog_entries.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blog_entries.owner_firm_id = p.target_owner_firm_id) )  === permission check: edit Role test role(53) === permission check: edit Role twiddler(3) SQL (1.2ms) select 'x' from roles where id = 53 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.1ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:31.567297', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:31.554313', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 6, "class_name" = 'BlogEntry', "target_owner_id" = NULL, "privilege" = 'add_comment', "target_owner_firm_id" = NULL WHERE "id" = 197 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role twiddler(3) === permission check: edit Role test role(53) SQL (1.1ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from roles where id = 53 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 53, "updated_at" = '2011-04-18 11:20:31.575679', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:31.534369', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 5, "class_name" = 'BlogEntry', "target_owner_id" = NULL, "privilege" = 'kill_comment', "target_owner_firm_id" = NULL WHERE "id" = 196 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role twiddler(3) === permission check: edit Role test role(53) SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.1ms) select 'x' from roles where id = 53 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 53, "updated_at" = '2011-04-18 11:20:31.584097', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:31.554313', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 6, "class_name" = 'BlogEntry', "target_owner_id" = NULL, "privilege" = 'add_comment', "target_owner_firm_id" = NULL WHERE "id" = 197 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.0ms) select 'x' from blog_entries where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'kill_comment' or p.privilege = 'any') and (p.class_name = 'BlogEntry') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blog_entries.owner_id = 5) and (p.target_id is null or blog_entries.id = p.target_id) and (p.target_owner_id is null or blog_entries.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blog_entries.owner_firm_id = p.target_owner_firm_id) )  SQL (1.1ms) select 'x' from blog_entries where id = 6 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'add_comment' or p.privilege = 'any') and (p.class_name = 'BlogEntry') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blog_entries.owner_id = 5) and (p.target_id is null or blog_entries.id = p.target_id) and (p.target_owner_id is null or blog_entries.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blog_entries.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(53) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 53 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 84 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:31.604539', '2011-04-18 11:20:31.604539', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(54) SQL (1.1ms) select 'x' from roles where id = 54 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:31.613014', '2011-04-18 11:20:31.613014', 54, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: kill_comment BlogEntry X(5) === permission check: edit Role test role(54) SQL (1.1ms) select 'x' from roles where id = 54 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('BlogEntry', '2011-04-18 11:20:31.623313', 'f', 5, NULL, '2011-04-18 11:20:31.623313', 54, NULL, 'kill_comment', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: kill_comment BlogEntry X(5) === FAILED permission check: add_comment BlogEntry X(6) === permission check: edit Role test role(54) === permission check: edit Role twiddler(3) SQL (1.3ms) select 'x' from roles where id = 54 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:31.693281', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:31.623313', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 5, "class_name" = 'BlogEntry', "target_owner_id" = NULL, "privilege" = 'kill_comment', "target_owner_firm_id" = NULL WHERE "id" = 198 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role test role(54) SQL (1.1ms) select 'x' from roles where id = 54 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('BlogEntry', '2011-04-18 11:20:31.699967', 'f', 6, NULL, '2011-04-18 11:20:31.699967', 54, NULL, 'add_comment', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === FAILED permission check: kill_comment BlogEntry X(5) === permission check: edit Role test role(54) === permission check: edit Role twiddler(3) SQL (1.1ms) select 'x' from roles where id = 54 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:20:31.711020', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:31.699967', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 6, "class_name" = 'BlogEntry', "target_owner_id" = NULL, "privilege" = 'add_comment', "target_owner_firm_id" = NULL WHERE "id" = 199 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role twiddler(3) === permission check: edit Role test role(54) SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.2ms) select 'x' from roles where id = 54 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 54, "updated_at" = '2011-04-18 11:20:31.720110', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:31.623313', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 5, "class_name" = 'BlogEntry', "target_owner_id" = NULL, "privilege" = 'kill_comment', "target_owner_firm_id" = NULL WHERE "id" = 198 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role twiddler(3) === permission check: edit Role test role(54) SQL (1.1ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.0ms) select 'x' from roles where id = 54 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 54, "updated_at" = '2011-04-18 11:20:31.728768', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:20:31.699967', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = 6, "class_name" = 'BlogEntry', "target_owner_id" = NULL, "privilege" = 'add_comment', "target_owner_firm_id" = NULL WHERE "id" = 199 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: kill_comment BlogEntry X(5) === permission check: add_comment BlogEntry X(6) SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(54) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 85 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:31.748324', '2011-04-18 11:20:31.748324', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(55) SQL (1.1ms) select 'x' from roles where id = 55 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:31.757067', '2011-04-18 11:20:31.757067', 55, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: kill_comment BlogEntry X(6) === permission check: edit Role test role(55) SQL (1.1ms) select 'x' from roles where id = 55 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('BlogEntry', '2011-04-18 11:20:31.767573', 'f', 6, NULL, '2011-04-18 11:20:31.767573', 55, NULL, 'kill_comment', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: kill_comment BlogEntry X(6) SQL (1.1ms) select 'x' from blog_entries where id = 6 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'kill_comment' or p.privilege = 'any') and (p.class_name = 'BlogEntry') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blog_entries.owner_id = 5) and (p.target_id is null or blog_entries.id = p.target_id) and (p.target_owner_id is null or blog_entries.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blog_entries.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(55) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 55 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 86 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.6ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 Role Load (0.6ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.5ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:31.792457', '2011-04-18 11:20:31.792457', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(56) SQL (1.8ms) select 'x' from roles where id = 56 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.7ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:31.806628', '2011-04-18 11:20:31.806628', 56, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.5ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.8ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.8ms) select 'x' from blog_entries where id = 6 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'add_comment' or p.privilege = 'any') and (p.class_name = 'BlogEntry') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blog_entries.owner_id = 5) and (p.target_id is null or blog_entries.id = p.target_id) and (p.target_owner_id is null or blog_entries.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blog_entries.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) ROLLBACK TO SAVEPOINT active_record_1 === permission check: edit Role test role(56) SQL (1.7ms) select 'x' from roles where id = 56 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('BlogEntry', '2011-04-18 11:20:31.828042', 'f', 6, NULL, '2011-04-18 11:20:31.828042', 56, NULL, 'add_comment', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.7ms) select 'x' from blog_entries where id = 6 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'add_comment' or p.privilege = 'any') and (p.class_name = 'BlogEntry') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blog_entries.owner_id = 5) and (p.target_id is null or blog_entries.id = p.target_id) and (p.target_owner_id is null or blog_entries.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blog_entries.owner_firm_id = p.target_owner_firm_id) )  EntryComment Update (0.9ms) UPDATE "entry_comments" SET "blog_entry_id" = 6, "updated_at" = '2011-04-18 11:20:31.838996' WHERE "id" = 1 SQL (0.4ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(56) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 56 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.5ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.5ms) DELETE FROM "role_assignments" WHERE "id" = 87 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.5ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:31.863290', '2011-04-18 11:20:31.863290', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(57) SQL (1.2ms) select 'x' from roles where id = 57 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:31.872055', '2011-04-18 11:20:31.872055', 57, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 BlogEntry Load (0.3ms) SELECT * FROM "blog_entries" WHERE ("blog_entries"."id" = 6)  === FAILED permission check: kill_comment BlogEntry X(6) SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 === permission check: edit Role test role(57) SQL (1.2ms) select 'x' from roles where id = 57 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('BlogEntry', '2011-04-18 11:20:31.884114', 'f', 6, NULL, '2011-04-18 11:20:31.884114', 57, NULL, 'kill_comment', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: kill_comment BlogEntry X(6) EntryComment Destroy (0.3ms) DELETE FROM "entry_comments" WHERE "id" = 1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(57) Role Destroy (0.2ms) DELETE FROM "roles" WHERE "id" = 57 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 88 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "entry_comments" ("created_at", "updated_at", "comment_txt", "owner_id", "owner_firm_id", "blog_entry_id") VALUES('2011-04-18 11:20:31.900136', '2011-04-18 11:20:31.900136', 'this is a comment', 2, 4, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:31.906676', '2011-04-18 11:20:31.906676', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(58) SQL (1.1ms) select 'x' from roles where id = 58 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:31.915258', '2011-04-18 11:20:31.915258', 58, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: add_comment BlogEntry X(5) === permission check: edit Role test role(58) SQL (1.1ms) select 'x' from roles where id = 58 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('BlogEntry', '2011-04-18 11:20:31.925835', 'f', 5, NULL, '2011-04-18 11:20:31.925835', 58, NULL, 'add_comment', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: add_comment BlogEntry X(5) SQL (1.1ms) select 'x' from blog_entries where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'add_comment' or p.privilege = 'any') and (p.class_name = 'BlogEntry') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blog_entries.owner_id = 5) and (p.target_id is null or blog_entries.id = p.target_id) and (p.target_owner_id is null or blog_entries.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blog_entries.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(58) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 58 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 89 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.5ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.6ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:31.950591', '2011-04-18 11:20:31.950591', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(59) SQL (1.8ms) select 'x' from roles where id = 59 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.7ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:31.965328', '2011-04-18 11:20:31.965328', 59, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.5ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.8ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: kill_comment BlogEntry X(5) === permission check: edit Role test role(59) SQL (2.0ms) select 'x' from roles where id = 59 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.2ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('BlogEntry', '2011-04-18 11:20:31.982024', 'f', 5, NULL, '2011-04-18 11:20:31.982024', 59, NULL, 'kill_comment', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: kill_comment BlogEntry X(5) SQL (2.0ms) select 'x' from blog_entries where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'kill_comment' or p.privilege = 'any') and (p.class_name = 'BlogEntry') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blog_entries.owner_id = 5) and (p.target_id is null or blog_entries.id = p.target_id) and (p.target_owner_id is null or blog_entries.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blog_entries.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(59) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 59 SQL (0.3ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 90 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.5ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.4ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.6ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:32.036748', '2011-04-18 11:20:32.036748', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(60) SQL (2.1ms) select 'x' from roles where id = 60 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.6ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.052442', '2011-04-18 11:20:32.052442', 60, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.5ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(60) SQL (1.7ms) select 'x' from roles where id = 60 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithCallbacks', '2011-04-18 11:20:32.066718', 'f', NULL, NULL, '2011-04-18 11:20:32.066718', 60, NULL, 'update', 'f', 'f', 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 === FAILED permission check: create PhonyWithCallbacks phony blog() SQL (0.2ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(60) Role Destroy (0.5ms) DELETE FROM "roles" WHERE "id" = 60 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 91 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 Role Load (0.7ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.5ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:32.098356', '2011-04-18 11:20:32.098356', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(61) SQL (1.8ms) select 'x' from roles where id = 61 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.6ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.112247', '2011-04-18 11:20:32.112247', 61, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.7ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.6ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.127358', '2011-04-18 11:20:32.127358', 4, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(61) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 61 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.6ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 92 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.2ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.5ms) DELETE FROM "role_assignments" WHERE "id" = 93 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 Role Load (0.6ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.5ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:32.170390', '2011-04-18 11:20:32.170390', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(62) SQL (1.8ms) select 'x' from roles where id = 62 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.6ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.184199', '2011-04-18 11:20:32.184199', 62, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.8ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 === FAILED permission check: create PhonyWithCallbacks phony blog() SQL (0.3ms) ROLLBACK TO SAVEPOINT active_record_1 === permission check: edit Role test role(62) SQL (1.9ms) select 'x' from roles where id = 62 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithCallbacks', '2011-04-18 11:20:32.203306', 'f', NULL, NULL, '2011-04-18 11:20:32.203306', 62, NULL, 'create', 'f', 'f', 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: create PhonyWithCallbacks phony blog() SQL (0.6ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('phony blog', '2011-04-18 11:20:32.211498', '2011-04-18 11:20:32.211498', 3, 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(62) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 62 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 94 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 Role Load (0.5ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.6ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:32.247868', '2011-04-18 11:20:32.247868', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(63) SQL (1.8ms) select 'x' from roles where id = 63 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.6ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.261981', '2011-04-18 11:20:32.261981', 63, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.8ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  PhonyWithCallbacks Load (0.4ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 13)  === FAILED permission check: find PhonyWithCallbacks phony blog(13) === permission check: edit Role test role(63) SQL (2.2ms) select 'x' from roles where id = 63 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithCallbacks', '2011-04-18 11:20:32.281808', 'f', NULL, NULL, '2011-04-18 11:20:32.281808', 63, NULL, 'find', 'f', 'f', 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  PhonyWithCallbacks Load (0.4ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 13)  === permission check: find PhonyWithCallbacks phony blog(13) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(63) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 63 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 95 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 Role Load (0.5ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.5ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:32.313529', '2011-04-18 11:20:32.313529', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(64) SQL (1.8ms) select 'x' from roles where id = 64 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.8ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.327823', '2011-04-18 11:20:32.327823', 64, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.8ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  PhonyWithCallbacks Load (0.4ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 13)  === FAILED permission check: find PhonyWithCallbacks phony blog(13) === permission check: edit Role test role(64) SQL (1.9ms) select 'x' from roles where id = 64 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithCallbacks', '2011-04-18 11:20:32.346361', 'f', NULL, NULL, '2011-04-18 11:20:32.346361', 64, NULL, 'find', 'f', 'f', 3) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  PhonyWithCallbacks Load (0.6ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 13)  === permission check: find PhonyWithCallbacks phony blog(13) SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(64) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 64 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 96 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:32.437729', '2011-04-18 11:20:32.437729', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(65) SQL (1.2ms) select 'x' from roles where id = 65 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.446991', '2011-04-18 11:20:32.446991', 65, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(65) SQL (1.1ms) select 'x' from roles where id = 65 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithCallbacks', '2011-04-18 11:20:32.456174', 'f', NULL, NULL, '2011-04-18 11:20:32.456174', 65, NULL, 'create', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  === FAILED permission check: update PhonyWithCallbacks phony blog updated(13) SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(65) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 65 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 97 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:32.478885', '2011-04-18 11:20:32.478885', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(66) SQL (1.2ms) select 'x' from roles where id = 66 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.487935', '2011-04-18 11:20:32.487935', 66, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  PhonyWithCallbacks Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 13)  === FAILED permission check: find PhonyWithCallbacks phony blog(13) === permission check: edit Role test role(66) SQL (1.1ms) select 'x' from roles where id = 66 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithCallbacks', '2011-04-18 11:20:32.499416', 'f', NULL, NULL, '2011-04-18 11:20:32.499416', 66, NULL, 'find', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  PhonyWithCallbacks Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 13)  === permission check: find PhonyWithCallbacks phony blog(13) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(66) Role Destroy (0.2ms) DELETE FROM "roles" WHERE "id" = 66 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 98 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:32.519310', '2011-04-18 11:20:32.519310', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(67) SQL (1.1ms) select 'x' from roles where id = 67 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.527967', '2011-04-18 11:20:32.527967', 67, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 === FAILED permission check: update PhonyWithCallbacks phony blog updated(13) SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 === permission check: edit Role test role(67) SQL (1.1ms) select 'x' from roles where id = 67 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithCallbacks', '2011-04-18 11:20:32.539507', 'f', NULL, NULL, '2011-04-18 11:20:32.539507', 67, NULL, 'update', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: update PhonyWithCallbacks phony blog updated(13) PhonyWithCallbacks Update (0.4ms) UPDATE "blogs" SET "updated_at" = '2011-04-18 11:20:32.544768', "name" = 'phony blog updated' WHERE "id" = 13 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(67) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 67 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 99 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:32.562104', '2011-04-18 11:20:32.562104', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(68) SQL (1.1ms) select 'x' from roles where id = 68 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.571073', '2011-04-18 11:20:32.571073', 68, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  PhonyWithCallbacks Load (0.5ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 13)  === FAILED permission check: find PhonyWithCallbacks phony blog updated(13) === permission check: edit Role test role(68) SQL (1.6ms) select 'x' from roles where id = 68 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithCallbacks', '2011-04-18 11:20:32.583509', 'f', NULL, NULL, '2011-04-18 11:20:32.583509', 68, NULL, 'find', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  PhonyWithCallbacks Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 13)  === permission check: find PhonyWithCallbacks phony blog updated(13) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(68) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 68 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 100 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:32.603328', '2011-04-18 11:20:32.603328', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(69) SQL (1.1ms) select 'x' from roles where id = 69 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.611898', '2011-04-18 11:20:32.611898', 69, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(69) SQL (1.1ms) select 'x' from roles where id = 69 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithCallbacks', '2011-04-18 11:20:32.620361', 'f', NULL, NULL, '2011-04-18 11:20:32.620361', 69, NULL, 'update', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === FAILED permission check: destroy PhonyWithCallbacks phony blog updated(13) SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(69) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 69 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 101 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:32.640899', '2011-04-18 11:20:32.640899', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(70) SQL (1.1ms) select 'x' from roles where id = 70 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.649498', '2011-04-18 11:20:32.649498', 70, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 === FAILED permission check: destroy PhonyWithCallbacks phony blog updated(13) SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 === permission check: edit Role test role(70) SQL (1.1ms) select 'x' from roles where id = 70 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithCallbacks', '2011-04-18 11:20:32.660327', 'f', NULL, NULL, '2011-04-18 11:20:32.660327', 70, NULL, 'destroy', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy PhonyWithCallbacks phony blog updated(13) PhonyWithCallbacks Destroy (0.3ms) DELETE FROM "blogs" WHERE "id" = 13 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(70) Role Destroy (0.2ms) DELETE FROM "roles" WHERE "id" = 70 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 102 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  PhonyWithCallbacks Load (0.2ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 13)  SQL (0.3ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.6ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (1.2ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:32.703646', '2011-04-18 11:20:32.703646', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(71) SQL (1.9ms) select 'x' from roles where id = 71 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.6ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.718693', '2011-04-18 11:20:32.718693', 71, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(71) SQL (1.8ms) select 'x' from roles where id = 71 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithEponymous', '2011-04-18 11:20:32.732321', 'f', NULL, NULL, '2011-04-18 11:20:32.732321', 71, NULL, 'update', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === FAILED permission check: create PhonyWithEponymous phony blog() SQL (0.2ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(71) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 71 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 User Load (0.6ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 103 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.4ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.6ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 Role Load (0.6ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:32.767300', '2011-04-18 11:20:32.767300', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(72) SQL (1.2ms) select 'x' from roles where id = 72 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.776854', '2011-04-18 11:20:32.776854', 72, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.2ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.787559', '2011-04-18 11:20:32.787559', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(72) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 72 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 104 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 105 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:32.816711', '2011-04-18 11:20:32.816711', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(73) SQL (1.2ms) select 'x' from roles where id = 73 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.826270', '2011-04-18 11:20:32.826270', 73, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 === FAILED permission check: create PhonyWithEponymous phony blog() SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 === permission check: edit Role test role(73) SQL (1.2ms) select 'x' from roles where id = 73 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithEponymous', '2011-04-18 11:20:32.839435', 'f', NULL, NULL, '2011-04-18 11:20:32.839435', 73, NULL, 'create', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: create PhonyWithEponymous phony blog() SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('phony blog', '2011-04-18 11:20:32.845476', '2011-04-18 11:20:32.845476', 3, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(73) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 73 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 106 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:32.870332', '2011-04-18 11:20:32.870332', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(74) SQL (1.2ms) select 'x' from roles where id = 74 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.880402', '2011-04-18 11:20:32.880402', 74, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  PhonyWithEponymous Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 14)  === FAILED permission check: find PhonyWithEponymous phony blog(14) === permission check: edit Role test role(74) SQL (1.2ms) select 'x' from roles where id = 74 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithEponymous', '2011-04-18 11:20:32.892935', 'f', NULL, NULL, '2011-04-18 11:20:32.892935', 74, NULL, 'find', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  PhonyWithEponymous Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 14)  === permission check: find PhonyWithEponymous phony blog(14) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(74) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 74 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 107 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:32.914313', '2011-04-18 11:20:32.914313', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(75) SQL (1.2ms) select 'x' from roles where id = 75 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:32.923979', '2011-04-18 11:20:32.923979', 75, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  PhonyWithEponymous Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 14)  === FAILED permission check: find PhonyWithEponymous phony blog(14) === permission check: edit Role test role(75) SQL (1.2ms) select 'x' from roles where id = 75 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithEponymous', '2011-04-18 11:20:33.002872', 'f', NULL, NULL, '2011-04-18 11:20:33.002872', 75, NULL, 'find', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  PhonyWithEponymous Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 14)  === permission check: find PhonyWithEponymous phony blog(14) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(75) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 75 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 108 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.027315', '2011-04-18 11:20:33.027315', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(76) SQL (1.2ms) select 'x' from roles where id = 76 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.037174', '2011-04-18 11:20:33.037174', 76, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(76) SQL (1.2ms) select 'x' from roles where id = 76 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithEponymous', '2011-04-18 11:20:33.046889', 'f', NULL, NULL, '2011-04-18 11:20:33.046889', 76, NULL, 'create', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  === FAILED permission check: update PhonyWithEponymous phony blog updated(14) SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(76) Role Destroy (0.6ms) DELETE FROM "roles" WHERE "id" = 76 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 109 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.073898', '2011-04-18 11:20:33.073898', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(77) SQL (1.2ms) select 'x' from roles where id = 77 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.083615', '2011-04-18 11:20:33.083615', 77, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  PhonyWithEponymous Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 14)  === FAILED permission check: find PhonyWithEponymous phony blog(14) === permission check: edit Role test role(77) SQL (1.2ms) select 'x' from roles where id = 77 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithEponymous', '2011-04-18 11:20:33.096307', 'f', NULL, NULL, '2011-04-18 11:20:33.096307', 77, NULL, 'find', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  PhonyWithEponymous Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 14)  === permission check: find PhonyWithEponymous phony blog(14) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(77) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 77 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 110 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.119989', '2011-04-18 11:20:33.119989', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(78) SQL (1.2ms) select 'x' from roles where id = 78 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.129675', '2011-04-18 11:20:33.129675', 78, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 === FAILED permission check: update PhonyWithEponymous phony blog updated(14) SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 === permission check: edit Role test role(78) SQL (1.2ms) select 'x' from roles where id = 78 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithEponymous', '2011-04-18 11:20:33.142560', 'f', NULL, NULL, '2011-04-18 11:20:33.142560', 78, NULL, 'update', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: update PhonyWithEponymous phony blog updated(14) PhonyWithEponymous Update (0.5ms) UPDATE "blogs" SET "updated_at" = '2011-04-18 11:20:33.148267', "name" = 'phony blog updated' WHERE "id" = 14 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(78) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 78 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 111 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.5ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.167943', '2011-04-18 11:20:33.167943', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(79) SQL (1.2ms) select 'x' from roles where id = 79 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.6ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.178105', '2011-04-18 11:20:33.178105', 79, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  PhonyWithEponymous Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 14)  === FAILED permission check: find PhonyWithEponymous phony blog updated(14) === permission check: edit Role test role(79) SQL (1.2ms) select 'x' from roles where id = 79 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithEponymous', '2011-04-18 11:20:33.190736', 'f', NULL, NULL, '2011-04-18 11:20:33.190736', 79, NULL, 'find', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  PhonyWithEponymous Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 14)  === permission check: find PhonyWithEponymous phony blog updated(14) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(79) Role Destroy (0.2ms) DELETE FROM "roles" WHERE "id" = 79 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 112 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.210920', '2011-04-18 11:20:33.210920', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(80) SQL (1.2ms) select 'x' from roles where id = 80 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.220468', '2011-04-18 11:20:33.220468', 80, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(80) SQL (1.2ms) select 'x' from roles where id = 80 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithEponymous', '2011-04-18 11:20:33.229691', 'f', NULL, NULL, '2011-04-18 11:20:33.229691', 80, NULL, 'update', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === FAILED permission check: destroy PhonyWithEponymous phony blog updated(14) SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.5ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(80) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 80 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 113 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.252058', '2011-04-18 11:20:33.252058', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(81) SQL (1.2ms) select 'x' from roles where id = 81 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.4ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.261824', '2011-04-18 11:20:33.261824', 81, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 === FAILED permission check: destroy PhonyWithEponymous phony blog updated(14) SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 === permission check: edit Role test role(81) SQL (1.2ms) select 'x' from roles where id = 81 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithEponymous', '2011-04-18 11:20:33.273859', 'f', NULL, NULL, '2011-04-18 11:20:33.273859', 81, NULL, 'destroy', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy PhonyWithEponymous phony blog updated(14) PhonyWithEponymous Destroy (0.3ms) DELETE FROM "blogs" WHERE "id" = 14 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(81) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 81 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 114 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  PhonyWithEponymous Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 14)  SQL (0.3ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.8ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.313096', '2011-04-18 11:20:33.313096', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(82) SQL (1.2ms) select 'x' from roles where id = 82 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.324153', '2011-04-18 11:20:33.324153', 82, 5, NULL, NULL) RETURNING "id" SQL (0.7ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(82) SQL (1.2ms) select 'x' from roles where id = 82 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithForAction', '2011-04-18 11:20:33.334038', 'f', NULL, NULL, '2011-04-18 11:20:33.334038', 82, NULL, 'update', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === FAILED permission check: create PhonyWithForAction phony blog() SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(82) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 82 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 115 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.355687', '2011-04-18 11:20:33.355687', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(83) SQL (1.5ms) select 'x' from roles where id = 83 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.365525', '2011-04-18 11:20:33.365525', 83, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.2ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.376021', '2011-04-18 11:20:33.376021', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(83) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 83 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 116 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 117 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.405061', '2011-04-18 11:20:33.405061', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(84) SQL (1.2ms) select 'x' from roles where id = 84 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.414586', '2011-04-18 11:20:33.414586', 84, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 === FAILED permission check: create PhonyWithForAction phony blog() SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 === permission check: edit Role test role(84) SQL (1.2ms) select 'x' from roles where id = 84 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithForAction', '2011-04-18 11:20:33.427384', 'f', NULL, NULL, '2011-04-18 11:20:33.427384', 84, NULL, 'create', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: create PhonyWithForAction phony blog() SQL (0.3ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('phony blog', '2011-04-18 11:20:33.432906', '2011-04-18 11:20:33.432906', 3, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(84) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 84 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.7ms) DELETE FROM "role_assignments" WHERE "id" = 118 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.455951', '2011-04-18 11:20:33.455951', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(85) SQL (1.5ms) select 'x' from roles where id = 85 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.465810', '2011-04-18 11:20:33.465810', 85, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  PhonyWithForAction Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 15)  === FAILED permission check: find PhonyWithForAction phony blog(15) === permission check: edit Role test role(85) SQL (1.2ms) select 'x' from roles where id = 85 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithForAction', '2011-04-18 11:20:33.478201', 'f', NULL, NULL, '2011-04-18 11:20:33.478201', 85, NULL, 'find', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  PhonyWithForAction Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 15)  === permission check: find PhonyWithForAction phony blog(15) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(85) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 85 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 119 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.500031', '2011-04-18 11:20:33.500031', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(86) SQL (1.2ms) select 'x' from roles where id = 86 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.511005', '2011-04-18 11:20:33.511005', 86, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  PhonyWithForAction Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 15)  === FAILED permission check: find PhonyWithForAction phony blog(15) === permission check: edit Role test role(86) SQL (1.3ms) select 'x' from roles where id = 86 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithForAction', '2011-04-18 11:20:33.589134', 'f', NULL, NULL, '2011-04-18 11:20:33.589134', 86, NULL, 'find', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  PhonyWithForAction Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 15)  === permission check: find PhonyWithForAction phony blog(15) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(86) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 86 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 120 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.613670', '2011-04-18 11:20:33.613670', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(87) SQL (1.2ms) select 'x' from roles where id = 87 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.623669', '2011-04-18 11:20:33.623669', 87, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(87) SQL (1.2ms) select 'x' from roles where id = 87 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithForAction', '2011-04-18 11:20:33.633777', 'f', NULL, NULL, '2011-04-18 11:20:33.633777', 87, NULL, 'create', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  === FAILED permission check: update PhonyWithForAction phony blog updated(15) SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(87) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 87 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 121 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.660823', '2011-04-18 11:20:33.660823', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(88) SQL (1.2ms) select 'x' from roles where id = 88 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.670948', '2011-04-18 11:20:33.670948', 88, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  PhonyWithForAction Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 15)  === FAILED permission check: find PhonyWithForAction phony blog(15) === permission check: edit Role test role(88) SQL (1.2ms) select 'x' from roles where id = 88 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithForAction', '2011-04-18 11:20:33.683541', 'f', NULL, NULL, '2011-04-18 11:20:33.683541', 88, NULL, 'find', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  PhonyWithForAction Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 15)  === permission check: find PhonyWithForAction phony blog(15) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(88) Role Destroy (0.2ms) DELETE FROM "roles" WHERE "id" = 88 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 122 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.705088', '2011-04-18 11:20:33.705088', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(89) SQL (1.1ms) select 'x' from roles where id = 89 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.714375', '2011-04-18 11:20:33.714375', 89, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 === FAILED permission check: update PhonyWithForAction phony blog updated(15) SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 === permission check: edit Role test role(89) SQL (1.2ms) select 'x' from roles where id = 89 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithForAction', '2011-04-18 11:20:33.727247', 'f', NULL, NULL, '2011-04-18 11:20:33.727247', 89, NULL, 'update', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: update PhonyWithForAction phony blog updated(15) PhonyWithForAction Update (0.5ms) UPDATE "blogs" SET "updated_at" = '2011-04-18 11:20:33.732968', "name" = 'phony blog updated' WHERE "id" = 15 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(89) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 89 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 123 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.752973', '2011-04-18 11:20:33.752973', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(90) SQL (1.2ms) select 'x' from roles where id = 90 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.762934', '2011-04-18 11:20:33.762934', 90, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  PhonyWithForAction Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 15)  === FAILED permission check: find PhonyWithForAction phony blog updated(15) === permission check: edit Role test role(90) SQL (1.2ms) select 'x' from roles where id = 90 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithForAction', '2011-04-18 11:20:33.775421', 'f', NULL, NULL, '2011-04-18 11:20:33.775421', 90, NULL, 'find', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  PhonyWithForAction Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 15)  === permission check: find PhonyWithForAction phony blog updated(15) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(90) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 90 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 124 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.797458', '2011-04-18 11:20:33.797458', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(91) SQL (1.2ms) select 'x' from roles where id = 91 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.6ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.807530', '2011-04-18 11:20:33.807530', 91, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(91) SQL (1.2ms) select 'x' from roles where id = 91 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithForAction', '2011-04-18 11:20:33.816814', 'f', NULL, NULL, '2011-04-18 11:20:33.816814', 91, NULL, 'update', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === FAILED permission check: destroy PhonyWithForAction phony blog updated(15) SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(91) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 91 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 125 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.838513', '2011-04-18 11:20:33.838513', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(92) SQL (1.2ms) select 'x' from roles where id = 92 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.848507', '2011-04-18 11:20:33.848507', 92, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 === FAILED permission check: destroy PhonyWithForAction phony blog updated(15) SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 === permission check: edit Role test role(92) SQL (1.2ms) select 'x' from roles where id = 92 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithForAction', '2011-04-18 11:20:33.860528', 'f', NULL, NULL, '2011-04-18 11:20:33.860528', 92, NULL, 'destroy', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy PhonyWithForAction phony blog updated(15) PhonyWithForAction Destroy (0.3ms) DELETE FROM "blogs" WHERE "id" = 15 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(92) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 92 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 126 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "blogs"  PhonyWithForAction Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 15)  SQL (0.3ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('phony blog', '2011-04-18 11:20:33.888782', '2011-04-18 11:20:33.888782', 3, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  === FAILED permission check: forbidden_operation PhonyNeverPermits phony blog(16) SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.910098', '2011-04-18 11:20:33.910098', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(93) SQL (1.2ms) select 'x' from roles where id = 93 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.919686', '2011-04-18 11:20:33.919686', 93, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.6ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.930587', '2011-04-18 11:20:33.930587', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  === FAILED permission check: change_post Blog mertz family blog(1) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(93) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 93 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 127 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 128 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:33.957636', '2011-04-18 11:20:33.957636', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(94) SQL (1.5ms) select 'x' from roles where id = 94 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:33.967410', '2011-04-18 11:20:33.967410', 94, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_post Blog mertz family blog(1) === permission check: edit Role test role(94) SQL (1.2ms) select 'x' from roles where id = 94 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:20:33.979197', 'f', 1, 'mertz family blog', '2011-04-18 11:20:33.979197', 94, NULL, 'change_post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_post Blog mertz family blog(1) === permission check: change_post Blog mertz family blog(1) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(94) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 94 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 129 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.007303', '2011-04-18 11:20:34.007303', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(95) SQL (1.1ms) select 'x' from roles where id = 95 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.016180', '2011-04-18 11:20:34.016180', 95, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: priv PhonyWithInitSet X() === permission check: edit Role test role(95) SQL (1.2ms) select 'x' from roles where id = 95 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithInitSet', '2011-04-18 11:20:34.031499', 'f', NULL, NULL, '2011-04-18 11:20:34.031499', 95, NULL, 'priv', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: priv PhonyWithInitSet X() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(95) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 95 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 130 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.8ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.052822', '2011-04-18 11:20:34.052822', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(96) SQL (1.2ms) select 'x' from roles where id = 96 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.062288', '2011-04-18 11:20:34.062288', 96, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: priv PhonyWithInitSet X() === permission check: edit Role test role(96) SQL (1.2ms) select 'x' from roles where id = 96 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithInitSet', '2011-04-18 11:20:34.074043', 'f', NULL, NULL, '2011-04-18 11:20:34.074043', 96, NULL, 'priv', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: priv PhonyWithInitSet X() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(96) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 96 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 131 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.159546', '2011-04-18 11:20:34.159546', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(97) SQL (1.2ms) select 'x' from roles where id = 97 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.170622', '2011-04-18 11:20:34.170622', 97, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: priv PhonyWithInitSet X() === permission check: edit Role test role(97) SQL (1.2ms) select 'x' from roles where id = 97 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithInitSet', '2011-04-18 11:20:34.182655', 'f', NULL, NULL, '2011-04-18 11:20:34.182655', 97, NULL, 'priv', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: priv PhonyWithInitSet X() === permission check: priv PhonyWithInitSet X() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(97) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 97 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 132 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('phony blog', '2011-04-18 11:20:34.202631', '2011-04-18 11:20:34.202631', 3, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.215335', '2011-04-18 11:20:34.215335', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(98) SQL (1.2ms) select 'x' from roles where id = 98 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.226401', '2011-04-18 11:20:34.226401', 98, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: priv PhonyWithInitSet phony blog(17) === permission check: edit Role test role(98) SQL (1.2ms) select 'x' from roles where id = 98 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithInitSet', '2011-04-18 11:20:34.238159', 'f', NULL, NULL, '2011-04-18 11:20:34.238159', 98, NULL, 'priv', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: priv PhonyWithInitSet phony blog(17) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(98) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 98 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 133 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.261613', '2011-04-18 11:20:34.261613', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(99) SQL (1.3ms) select 'x' from roles where id = 99 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.272013', '2011-04-18 11:20:34.272013', 99, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: priv PhonyWithInitSet phony blog(17) === permission check: edit Role test role(99) SQL (1.2ms) select 'x' from roles where id = 99 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithInitSet', '2011-04-18 11:20:34.284096', 'f', NULL, NULL, '2011-04-18 11:20:34.284096', 99, NULL, 'priv', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: priv PhonyWithInitSet phony blog(17) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(99) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 99 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 134 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.305183', '2011-04-18 11:20:34.305183', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(100) SQL (1.2ms) select 'x' from roles where id = 100 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.314977', '2011-04-18 11:20:34.314977', 100, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: priv PhonyWithInitSet phony blog(17) === permission check: edit Role test role(100) SQL (1.2ms) select 'x' from roles where id = 100 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyWithInitSet', '2011-04-18 11:20:34.326604', 'f', NULL, NULL, '2011-04-18 11:20:34.326604', 100, NULL, 'priv', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: priv PhonyWithInitSet phony blog(17) === permission check: priv PhonyWithInitSet phony blog(17) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(100) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 100 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 135 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 1)  Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 4)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 1)  Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 4)  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.366894', '2011-04-18 11:20:34.366894', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(101) SQL (1.2ms) select 'x' from roles where id = 101 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.377049', '2011-04-18 11:20:34.377049', 101, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments"."id" = 2)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 101 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 101)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('User', 'f', '2011-04-18 11:20:34.390471', 4, 'ricky', '2011-04-18 11:20:34.390471', 101, NULL, 'administer', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(101) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 101 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 136 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.418109', '2011-04-18 11:20:34.418109', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(102) SQL (1.2ms) select 'x' from roles where id = 102 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.427723', '2011-04-18 11:20:34.427723', 102, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.2ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.440719', '2011-04-18 11:20:34.440719', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 102 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 102)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('PhonyReqPermEntry', 'f', '2011-04-18 11:20:34.454372', NULL, NULL, '2011-04-18 11:20:34.454372', 102, NULL, 'blurt', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (2.0ms) select 'x' from roles where id = 102 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 102)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('PhonyReqPermBlog', 'f', '2011-04-18 11:20:34.467626', NULL, NULL, '2011-04-18 11:20:34.467626', 102, NULL, 'bloviate', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(102) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 102 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 137 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 138 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.502435', '2011-04-18 11:20:34.502435', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(103) SQL (1.2ms) select 'x' from roles where id = 103 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.512078', '2011-04-18 11:20:34.512078', 103, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  === FAILED permission check: change_name PhonyBlog X() === permission check: edit Role test role(103) SQL (1.3ms) select 'x' from roles where id = 103 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyBlog', '2011-04-18 11:20:34.531094', 'f', NULL, NULL, '2011-04-18 11:20:34.531094', 103, NULL, 'change_name', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_name PhonyBlog X() === permission check: change_name PhonyBlog X() SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('phony', '2011-04-18 11:20:34.538149', '2011-04-18 11:20:34.538149', 3, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(103) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 103 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 139 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.560233', '2011-04-18 11:20:34.560233', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(104) SQL (1.2ms) select 'x' from roles where id = 104 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.570237', '2011-04-18 11:20:34.570237', 104, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 104 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 104)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('PhonyBlog', 'f', '2011-04-18 11:20:34.580552', 18, 'phony', '2011-04-18 11:20:34.580552', 104, NULL, 'grubbitz', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 3 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(104) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 104 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 140 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.612819', '2011-04-18 11:20:34.612819', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(105) SQL (1.2ms) select 'x' from roles where id = 105 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.622539', '2011-04-18 11:20:34.622539', 105, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.7ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_name PhonyBlog X() === permission check: edit Role test role(105) SQL (1.2ms) select 'x' from roles where id = 105 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyBlog', '2011-04-18 11:20:34.635639', 'f', NULL, NULL, '2011-04-18 11:20:34.635639', 105, NULL, 'change_name', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_name PhonyBlog X() === permission check: change_name PhonyBlog X() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(105) Role Destroy (0.8ms) DELETE FROM "roles" WHERE "id" = 105 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 141 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (1.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.726641', '2011-04-18 11:20:34.726641', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(106) SQL (1.1ms) select 'x' from roles where id = 106 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.735703', '2011-04-18 11:20:34.735703', 106, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  === FAILED permission check: grubbitz PhonyBlog X() === permission check: edit Role test role(106) SQL (1.1ms) select 'x' from roles where id = 106 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyBlog', '2011-04-18 11:20:34.748240', 'f', NULL, NULL, '2011-04-18 11:20:34.748240', 106, NULL, 'grubbitz', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: grubbitz PhonyBlog X() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(106) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 106 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 142 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.768712', '2011-04-18 11:20:34.768712', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(107) SQL (1.1ms) select 'x' from roles where id = 107 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.777737', '2011-04-18 11:20:34.777737', 107, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: grubbitz PhonyBlog X() === permission check: edit Role test role(107) SQL (1.1ms) select 'x' from roles where id = 107 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyBlog', '2011-04-18 11:20:34.789003', 'f', NULL, NULL, '2011-04-18 11:20:34.789003', 107, NULL, 'grubbitz', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: grubbitz PhonyBlog X() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(107) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 107 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 143 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.808625', '2011-04-18 11:20:34.808625', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(108) SQL (1.1ms) select 'x' from roles where id = 108 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.817319', '2011-04-18 11:20:34.817319', 108, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: grabbitz PhonyBlog X() === permission check: edit Role test role(108) SQL (1.1ms) select 'x' from roles where id = 108 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyBlog', '2011-04-18 11:20:34.827853', 'f', NULL, NULL, '2011-04-18 11:20:34.827853', 108, NULL, 'grabbitz', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: grabbitz PhonyBlog X() === permission check: grabbitz PhonyBlog X() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(108) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 108 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 144 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.850321', '2011-04-18 11:20:34.850321', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(109) SQL (1.2ms) select 'x' from roles where id = 109 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.859397', '2011-04-18 11:20:34.859397', 109, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: grabbitz PhonyBlog X() === permission check: edit Role test role(109) SQL (1.2ms) select 'x' from roles where id = 109 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyBlog', '2011-04-18 11:20:34.869779', 'f', NULL, NULL, '2011-04-18 11:20:34.869779', 109, NULL, 'grabbitz', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: grabbitz PhonyBlog X() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(109) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 109 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 145 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.5ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.895915', '2011-04-18 11:20:34.895915', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(110) SQL (1.1ms) select 'x' from roles where id = 110 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.904717', '2011-04-18 11:20:34.904717', 110, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.7ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  Firm Load (0.6ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  === FAILED permission check: change_name PhonyBlog X() === permission check: edit Role test role(110) SQL (1.1ms) select 'x' from roles where id = 110 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyBlog', '2011-04-18 11:20:34.917212', 'f', NULL, NULL, '2011-04-18 11:20:34.917212', 110, NULL, 'change_name', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_name PhonyBlog X() === permission check: change_name PhonyBlog X() SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('FunkyBlog', '2011-04-18 11:20:34.923766', '2011-04-18 11:20:34.923766', 3, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(110) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 110 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 146 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.6ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.940870', '2011-04-18 11:20:34.940870', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(111) SQL (1.1ms) select 'x' from roles where id = 111 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.950047', '2011-04-18 11:20:34.950047', 111, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: grubbitz PhonyBlog FunkyBlog(19) === permission check: edit Role test role(111) SQL (1.1ms) select 'x' from roles where id = 111 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyBlog', '2011-04-18 11:20:34.960283', 'f', 19, 'FunkyBlog', '2011-04-18 11:20:34.960283', 111, NULL, 'grubbitz', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: grubbitz PhonyBlog FunkyBlog(19) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(111) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 111 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 147 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:34.978905', '2011-04-18 11:20:34.978905', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(112) SQL (1.1ms) select 'x' from roles where id = 112 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:34.987466', '2011-04-18 11:20:34.987466', 112, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: grabbitz PhonyBlog FunkyBlog(19) === permission check: edit Role test role(112) SQL (1.1ms) select 'x' from roles where id = 112 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyBlog', '2011-04-18 11:20:34.997409', 'f', 19, 'FunkyBlog', '2011-04-18 11:20:34.997409', 112, NULL, 'grabbitz', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: grabbitz PhonyBlog FunkyBlog(19) === permission check: grabbitz PhonyBlog FunkyBlog(19) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(112) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 112 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 148 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:35.017012', '2011-04-18 11:20:35.017012', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(113) SQL (1.1ms) select 'x' from roles where id = 113 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (2.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:35.027782', '2011-04-18 11:20:35.027782', 113, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: grubbitz PhonyBlog FunkyBlog(19) === permission check: edit Role test role(113) SQL (1.8ms) select 'x' from roles where id = 113 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyBlog', '2011-04-18 11:20:35.041666', 'f', 19, 'FunkyBlog', '2011-04-18 11:20:35.041666', 113, NULL, 'grubbitz', 'f', 'f', NULL) RETURNING "id" SQL (0.3ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: grubbitz PhonyBlog FunkyBlog(19) SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(113) Role Destroy (0.5ms) DELETE FROM "roles" WHERE "id" = 113 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 149 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) ROLLBACK SQL (0.1ms) BEGIN PhonyNeverPermits Load (0.4ms) SELECT * FROM "blogs" LIMIT 1 User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.5ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.5ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:35.081802', '2011-04-18 11:20:35.081802', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(114) SQL (1.8ms) select 'x' from roles where id = 114 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.8ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:35.097213', '2011-04-18 11:20:35.097213', 114, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(114) SQL (1.8ms) select 'x' from roles where id = 114 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('PhonyNeverPermits', '2011-04-18 11:20:35.110874', 'f', NULL, NULL, '2011-04-18 11:20:35.110874', 114, NULL, 'any', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  PhonyNeverPermits Load (0.4ms) SELECT * FROM "blogs" WHERE (2 + 2 = 5)  === FAILED permission check: forbidden_operation PhonyNeverPermits ricky's dubuque blog(3) SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(114) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 114 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 150 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  Role Load (0.6ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: assign Role twiddler(3) SQL (1.8ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  === permission check: administer User ricky(4) SQL (1.6ms) select 'x' from users where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:35.154580', '2011-04-18 11:20:35.154580', 3, 4, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 2)  === permission check: assign Role admin(2) === FAILED permission check: forbidden_operation RoleAssignment X(151) User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  === permission check: administer User ricky(4) === permission check: administer User lucy(3) === FAILED permission check: forbidden_operation RoleAssignment X(151) === FAILED permission check: forbidden_operation RoleAssignment X(151) === FAILED permission check: forbidden_operation RoleAssignment X(151) SQL (0.3ms) ROLLBACK SQL (0.2ms) BEGIN User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.5ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.3ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.6ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:35.189910', '2011-04-18 11:20:35.189910', 6, 2) RETURNING "id" SQL (0.6ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(115) SQL (1.9ms) select 'x' from roles where id = 115 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.9ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:35.205847', '2011-04-18 11:20:35.205847', 115, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.8ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: administer User lucy(3) === permission check: edit Role test role(115) SQL (1.8ms) select 'x' from roles where id = 115 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('User', '2011-04-18 11:20:35.224031', 'f', 3, 'lucy', '2011-04-18 11:20:35.224031', 115, NULL, 'administer', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: administer User lucy(3) SQL (1.7ms) select 'x' from users where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 5) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(115) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 115 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 152 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:35.323043', '2011-04-18 11:20:35.323043', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(116) SQL (1.1ms) select 'x' from roles where id = 116 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:35.332077', '2011-04-18 11:20:35.332077', 116, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: assign Role twiddler(3) === permission check: edit Role test role(116) SQL (1.1ms) select 'x' from roles where id = 116 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Role', '2011-04-18 11:20:35.343559', 'f', 3, 'twiddler', '2011-04-18 11:20:35.343559', 116, NULL, 'assign', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: assign Role twiddler(3) SQL (1.1ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(116) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 116 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 153 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:35.362357', '2011-04-18 11:20:35.362357', 3, 3, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 4)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" IS NULL AND "roles"."owner_firm_id" IS NULL) LIMIT 1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" IS NULL AND "roles"."owner_firm_id" = 4) LIMIT 1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" IS NULL AND "roles"."owner_firm_id" = 4) LIMIT 1 Role Load (0.2ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" IS NULL AND "roles"."owner_firm_id" = 4) LIMIT 1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = '' AND "roles"."owner_firm_id" = 4) LIMIT 1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'x' AND "roles"."owner_firm_id" = 4) LIMIT 1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'ab' AND "roles"."owner_firm_id" = 4) LIMIT 1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'admin' AND "roles"."owner_firm_id" = 4) LIMIT 1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' AND "roles"."owner_firm_id" = 4) LIMIT 1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'twiddler' AND "roles"."owner_firm_id" = 4) LIMIT 1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' AND "roles"."owner_firm_id" = 4) LIMIT 1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' AND "roles"."owner_firm_id" = 4) LIMIT 1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:20:35.397641', '2011-04-18 11:20:35.397641', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(117) SQL (1.1ms) select 'x' from roles where id = 117 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:20:35.406594', '2011-04-18 11:20:35.406594', 117, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' AND "roles"."owner_firm_id" = 4) LIMIT 1 === FAILED permission check: create Role xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx() SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 === permission check: edit Role test role(117) SQL (1.1ms) select 'x' from roles where id = 117 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Role', '2011-04-18 11:20:35.420027', 'f', NULL, NULL, '2011-04-18 11:20:35.420027', 117, 4, 'create', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' AND "roles"."owner_firm_id" = 4) LIMIT 1 === permission check: create Role xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', '2011-04-18 11:20:35.427057', '2011-04-18 11:20:35.427057', 2, 4) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(117) Role Destroy (0.2ms) DELETE FROM "roles" WHERE "id" = 117 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 155 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.3ms) SET client_min_messages TO 'ERROR' SQL (0.1ms) SET client_min_messages TO 'panic' SQL (0.1ms) SET standard_conforming_strings = on SQL (0.1ms) SET client_min_messages TO 'error' SQL (12.7ms) DROP TABLE "blog_entries" SQL (108.1ms) CREATE TABLE "blog_entries" ("id" serial primary key, "blog_id" integer NOT NULL, "entry_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (54.9ms) CREATE INDEX "blog_entries_by_firm" ON "blog_entries" ("owner_firm_id") SQL (54.8ms) CREATE INDEX "blog_entries_by_owner" ON "blog_entries" ("owner_id") SQL (12.3ms) DROP TABLE "blogs" SQL (61.6ms) CREATE TABLE "blogs" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (55.0ms) CREATE INDEX "blogs_by_firm" ON "blogs" ("owner_firm_id") SQL (61.6ms) CREATE INDEX "blogs_by_owner" ON "blogs" ("owner_id") SQL (60.9ms) CREATE UNIQUE INDEX "ix_blogs_by_name_owner_firm" ON "blogs" ("name", "owner_firm_id") SQL (20.8ms) DROP TABLE "entry_comments" SQL (95.6ms) CREATE TABLE "entry_comments" ("id" serial primary key, "blog_entry_id" integer, "comment_txt" text NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (62.7ms) CREATE INDEX "entry_comments_by_firm" ON "entry_comments" ("owner_firm_id") SQL (73.8ms) CREATE INDEX "entry_comments_by_owner" ON "entry_comments" ("owner_id") SQL (9.4ms) DROP TABLE "firms" SQL (77.3ms) CREATE TABLE "firms" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (17.8ms) DROP TABLE "pcheck_log_entries" SQL (55.9ms) CREATE TABLE "pcheck_log_entries" ("id" serial primary key, "request_log_entry_id" integer NOT NULL, "success" boolean NOT NULL, "model_class" character varying(100) NOT NULL, "model_id" integer, "privilege" character varying(40) NOT NULL, "user_id" integer NOT NULL, "user_name" character varying(100) NOT NULL, "created_at" timestamp, "updated_at" timestamp)  SQL (9.6ms) DROP TABLE "permissions" SQL (64.3ms) CREATE TABLE "permissions" ("id" serial primary key, "role_id" integer, "is_grant" boolean NOT NULL, "has_grant_option" boolean NOT NULL, "class_name" character varying(40) NOT NULL, "privilege" character varying(40) NOT NULL, "target_owned_by_self" boolean NOT NULL, "target_owner_id" integer, "target_owner_firm_id" integer, "target_id" integer, "target_name" character varying(100), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (73.7ms) CREATE INDEX "index_permissions_on_role_id" ON "permissions" ("role_id") SQL (9.7ms) DROP TABLE "request_log_entries" SQL (97.2ms) CREATE TABLE "request_log_entries" ("id" serial primary key, "created_at" timestamp, "updated_at" timestamp, "acting_user_id" integer, "user_of_record_id" integer, "acting_user_name" character varying(255), "user_of_record_name" character varying(255), "controller" character varying(100) NOT NULL, "action" character varying(100) NOT NULL, "http_method" character varying(50) NOT NULL, "status" character varying(100) NOT NULL, "model_class" character varying(100), "model_id" integer, "remote_ip" character varying(50))  SQL (9.1ms) DROP TABLE "role_assignments" SQL (75.4ms) CREATE TABLE "role_assignments" ("id" serial primary key, "user_id" integer NOT NULL, "role_id" integer NOT NULL, "default_user_id" integer, "default_firm_id" integer, "invalid_after" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (10.0ms) DROP TABLE "roles" SQL (74.9ms) CREATE TABLE "roles" ("id" serial primary key, "name" character varying(100) NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "owner_id" integer NOT NULL, "owner_firm_id" integer NOT NULL)  SQL (62.7ms) CREATE INDEX "roles_by_firm" ON "roles" ("owner_firm_id") SQL (62.8ms) CREATE INDEX "roles_by_owner" ON "roles" ("owner_id") SQL (9.0ms) DROP TABLE "users" SQL (65.0ms) CREATE TABLE "users" ("id" serial primary key, "name" character varying(100) NOT NULL, "owner_firm_id" integer NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  SQL (8.6ms) SELECT version FROM "schema_migrations" SQL (0.1ms) BEGIN User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.5ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.5ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (1.1ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.3ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:41.693052', '2011-04-18 11:22:41.693052', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(5) SQL (1.4ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.3ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:41.709245', '2011-04-18 11:22:41.709245', 5, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.8ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_guarded AcPhonyBlog X() === permission check: edit Role test role(5) SQL (1.3ms) select 'x' from roles where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('AcPhonyBlog', '2011-04-18 11:22:41.731493', 'f', NULL, NULL, '2011-04-18 11:22:41.731493', 5, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(5) Role Destroy (1.1ms) DELETE FROM "roles" WHERE "id" = 5 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.6ms) DELETE FROM "role_assignments" WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:41.762639', '2011-04-18 11:22:41.762639', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(6) SQL (1.3ms) select 'x' from roles where id = 6 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:41.772738', '2011-04-18 11:22:41.772738', 6, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.2ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:41.783644', '2011-04-18 11:22:41.783644', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:41.815490', '2011-04-18 11:22:41.815490', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(7) SQL (1.2ms) select 'x' from roles where id = 7 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:41.826209', '2011-04-18 11:22:41.826209', 7, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_guarded AcPhonyBlog X() === permission check: edit Role test role(7) SQL (1.2ms) select 'x' from roles where id = 7 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('AcPhonyBlog', '2011-04-18 11:22:41.838930', 'f', NULL, NULL, '2011-04-18 11:22:41.838930', 7, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(7) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 7 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 25 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.6ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:41.863135', '2011-04-18 11:22:41.863135', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(8) SQL (1.3ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:41.873723', '2011-04-18 11:22:41.873723', 8, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.2ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:41.884829', '2011-04-18 11:22:41.884829', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.3ms) select 'x' from roles where id = 8 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 8)  SQL (0.5ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('AcPhonyBlog', 'f', '2011-04-18 11:22:41.920381', NULL, 'fred the blog', '2011-04-18 11:22:41.920381', 8, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(8) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 8 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 26 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 27 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.5ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.5ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:41.958923', '2011-04-18 11:22:41.958923', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(9) SQL (1.2ms) select 'x' from roles where id = 9 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:41.968161', '2011-04-18 11:22:41.968161', 9, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_guarded AcPhonyBlog X() === permission check: edit Role test role(9) SQL (1.2ms) select 'x' from roles where id = 9 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('AcPhonyBlog', '2011-04-18 11:22:41.980501', 'f', NULL, NULL, '2011-04-18 11:22:41.980501', 9, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(9) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 9 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 28 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:42.000688', '2011-04-18 11:22:42.000688', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(10) SQL (1.2ms) select 'x' from roles where id = 10 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:42.009629', '2011-04-18 11:22:42.009629', 10, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.1ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.5ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:42.019860', '2011-04-18 11:22:42.019860', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.3ms) select 'x' from roles where id = 10 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 10)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('AcPhonyBlog', 'f', '2011-04-18 11:22:42.092989', NULL, 'fred the blog', '2011-04-18 11:22:42.092989', 10, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(10) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 10 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 29 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 30 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:42.130376', '2011-04-18 11:22:42.130376', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(11) SQL (1.1ms) select 'x' from roles where id = 11 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:42.139384', '2011-04-18 11:22:42.139384', 11, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_guarded AcPhonyBlog X() === permission check: edit Role test role(11) SQL (1.2ms) select 'x' from roles where id = 11 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('AcPhonyBlog', '2011-04-18 11:22:42.150909', 'f', NULL, NULL, '2011-04-18 11:22:42.150909', 11, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(11) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 11 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 31 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:42.171573', '2011-04-18 11:22:42.171573', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(12) SQL (1.1ms) select 'x' from roles where id = 12 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:42.180393', '2011-04-18 11:22:42.180393', 12, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.2ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:42.190139', '2011-04-18 11:22:42.190139', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:42.208544', '2011-04-18 11:22:42.208544', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(13) SQL (1.1ms) select 'x' from roles where id = 13 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:42.218010', '2011-04-18 11:22:42.218010', 13, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_guarded AcPhonyBlog X() === permission check: edit Role test role(13) SQL (1.2ms) select 'x' from roles where id = 13 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('AcPhonyBlog', '2011-04-18 11:22:42.229723', 'f', NULL, NULL, '2011-04-18 11:22:42.229723', 13, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(13) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 13 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 34 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:42.249882', '2011-04-18 11:22:42.249882', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(14) SQL (1.1ms) select 'x' from roles where id = 14 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:42.258666', '2011-04-18 11:22:42.258666', 14, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.7ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.6ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:42.273850', '2011-04-18 11:22:42.273850', 4, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.5ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 SQL (1.3ms) select 'x' from roles where id = 14 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 14)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('AcPhonyBlog', 'f', '2011-04-18 11:22:42.977550', NULL, 'fred the blog', '2011-04-18 11:22:42.977550', 14, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(14) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 14 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 35 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 36 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:43.013317', '2011-04-18 11:22:43.013317', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(15) SQL (1.2ms) select 'x' from roles where id = 15 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:43.022049', '2011-04-18 11:22:43.022049', 15, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_guarded AcPhonyBlog X() === permission check: edit Role test role(15) SQL (2.0ms) select 'x' from roles where id = 15 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('AcPhonyBlog', '2011-04-18 11:22:43.033832', 'f', NULL, NULL, '2011-04-18 11:22:43.033832', 15, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(15) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 15 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 37 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:43.054397', '2011-04-18 11:22:43.054397', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(16) SQL (1.1ms) select 'x' from roles where id = 16 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.4ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:43.063679', '2011-04-18 11:22:43.063679', 16, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.1ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:43.073102', '2011-04-18 11:22:43.073102', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.1ms) select 'x' from roles where id = 16 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 16)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('AcPhonyBlog', 'f', '2011-04-18 11:22:43.086564', NULL, 'fred the blog', '2011-04-18 11:22:43.086564', 16, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(16) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 16 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 38 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 39 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:43.117506', '2011-04-18 11:22:43.117506', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(17) SQL (1.2ms) select 'x' from roles where id = 17 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:43.126256', '2011-04-18 11:22:43.126256', 17, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.6ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_guarded AcPhonyBlog X() === permission check: edit Role test role(17) SQL (1.2ms) select 'x' from roles where id = 17 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('AcPhonyBlog', '2011-04-18 11:22:43.137254', 'f', NULL, NULL, '2011-04-18 11:22:43.137254', 17, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(17) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 17 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 40 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:43.157235', '2011-04-18 11:22:43.157235', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(18) SQL (1.3ms) select 'x' from roles where id = 18 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.7ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:43.169380', '2011-04-18 11:22:43.169380', 18, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.8ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.8ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:43.184940', '2011-04-18 11:22:43.184940', 4, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 SQL (2.0ms) select 'x' from roles where id = 18 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 18)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('AcPhonyBlog', 'f', '2011-04-18 11:22:43.207421', NULL, 'fred the blog', '2011-04-18 11:22:43.207421', 18, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(18) Role Destroy (0.5ms) DELETE FROM "roles" WHERE "id" = 18 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 41 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 42 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.5ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.5ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.5ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:43.257444', '2011-04-18 11:22:43.257444', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(19) SQL (1.8ms) select 'x' from roles where id = 19 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (2.5ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:43.272715', '2011-04-18 11:22:43.272715', 19, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.7ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.8ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_guarded AcPhonyBlog X() === permission check: edit Role test role(19) SQL (1.8ms) select 'x' from roles where id = 19 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.3ms) SAVEPOINT active_record_1 SQL (0.7ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('AcPhonyBlog', '2011-04-18 11:22:43.290678', 'f', NULL, NULL, '2011-04-18 11:22:43.290678', 19, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(19) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 19 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 43 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:43.369222', '2011-04-18 11:22:43.369222', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(20) SQL (1.1ms) select 'x' from roles where id = 20 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.7ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:43.380523', '2011-04-18 11:22:43.380523', 20, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.1ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:43.392550', '2011-04-18 11:22:43.392550', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.3ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 20 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 20)  SQL (0.5ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('AcPhonyBlog', 'f', '2011-04-18 11:22:43.408319', NULL, 'fred the blog', '2011-04-18 11:22:43.408319', 20, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(20) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 20 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 44 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 45 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.2ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:43.441278', '2011-04-18 11:22:43.441278', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(21) SQL (1.1ms) select 'x' from roles where id = 21 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:43.450103', '2011-04-18 11:22:43.450103', 21, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.5ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: change_guarded AcPhonyBlog X() === permission check: edit Role test role(21) SQL (1.2ms) select 'x' from roles where id = 21 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('AcPhonyBlog', '2011-04-18 11:22:43.462304', 'f', NULL, NULL, '2011-04-18 11:22:43.462304', 21, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog X() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() === permission check: change_guarded AcPhonyBlog fred the blog() SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(21) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 21 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 46 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 === permission check: create Role test role() SQL (0.3ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:43.482582', '2011-04-18 11:22:43.482582', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(22) SQL (1.1ms) select 'x' from roles where id = 22 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.1ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:43.491309', '2011-04-18 11:22:43.491309', 22, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.1ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:43.500767', '2011-04-18 11:22:43.500767', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.1ms) select 'x' from roles where id = 22 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 22)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('AcPhonyBlog', 'f', '2011-04-18 11:22:43.514212', NULL, 'fred the blog', '2011-04-18 11:22:43.514212', 22, NULL, 'change_guarded', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(22) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 22 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 47 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 48 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN Firm Load (0.5ms) SELECT * FROM "firms" WHERE ("firms"."id" = 4)  Blog Load (0.9ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" IS NULL AND "blogs"."owner_firm_id" IS NULL) LIMIT 1 Blog Load (0.5ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" IS NULL AND "blogs"."owner_firm_id" = 4) LIMIT 1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 2)  Blog Load (0.3ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" IS NULL AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.3ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" IS NULL AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.3ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" IS NULL AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.3ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = '' AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.3ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'x' AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.3ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'ab' AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.3ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'mertz family blog' AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.3ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.3ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'ricardo family blog' AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.3ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' AND "blogs"."owner_firm_id" = 4) LIMIT 1 Blog Load (0.3ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' AND "blogs"."owner_firm_id" = 4) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' AND "blogs"."owner_firm_id" = 4) LIMIT 1 SQL (0.3ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', '2011-04-18 11:22:43.586360', '2011-04-18 11:22:43.586360', 2, 4) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.3ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 2)  Firm Load (0.5ms) SELECT * FROM "firms" WHERE ("firms"."id" = 4)  SQL (0.2ms) ROLLBACK SQL (0.2ms) BEGIN User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 2)  SQL (1.8ms) select 'x' from roles where id = 2 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 4 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 4) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (1.8ms) select 'x' from roles where id = 2 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 4 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 4) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 1)  Permission Load (1.3ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 4 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === FAILED permission check: assign Role admin(1) SQL (0.3ms) ROLLBACK SQL (0.2ms) BEGIN User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 2)  Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 4 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role admin(2) Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 1)  === FAILED permission check: edit Role admin(1) SQL (0.3ms) ROLLBACK SQL (0.2ms) BEGIN User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 2)  Permission Load (1.3ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role admin(2) SQL (1.8ms) select 'x' from roles where id = 2 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.8ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 'f', '2011-04-18 11:22:44.728319', NULL, NULL, '2011-04-18 11:22:44.728319', 2, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 4 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role admin(2) SQL (1.8ms) select 'x' from roles where id = 2 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 4 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 4) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.2ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.3ms) ROLLBACK SQL (0.2ms) BEGIN Blog Load (0.5ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Blog Load (0.4ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  SQL (0.2ms) ROLLBACK SQL (0.1ms) BEGIN SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN Role Load (0.5ms) SELECT * FROM "roles" WHERE ("roles"."id" = 1)  User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.5ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.2ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.6ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:44.773241', '2011-04-18 11:22:44.773241', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(23) SQL (1.8ms) select 'x' from roles where id = 23 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.8ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:44.788071', '2011-04-18 11:22:44.788071', 23, 5, NULL, NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.8ms) SELECT count(*) AS count_all FROM "roles" INNER JOIN "role_assignments" ON "roles".id = "role_assignments".role_id WHERE (("role_assignments".user_id = 5) AND (((role_assignments.invalid_after is null or role_assignments.invalid_after > now()))))  === FAILED permission check: edit Role admin(1) === permission check: edit Role test role(23) SQL (1.9ms) select 'x' from roles where id = 23 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Role', '2011-04-18 11:22:44.806136', 'f', 1, 'admin', '2011-04-18 11:22:44.806136', 23, NULL, 'edit', 'f', 'f', NULL) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.1ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role admin(1) SQL (1.8ms) select 'x' from roles where id = 1 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.2ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(23) Role Destroy (0.4ms) DELETE FROM "roles" WHERE "id" = 23 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.4ms) DELETE FROM "role_assignments" WHERE "id" = 49 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.2ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 'f', '2011-04-18 11:22:44.852586', NULL, NULL, '2011-04-18 11:22:44.852586', 1, NULL, 'any', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.3ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:44.867333', '2011-04-18 11:22:44.867333', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(24) SQL (1.1ms) select 'x' from roles where id = 24 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.0ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.3ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:44.876256', '2011-04-18 11:22:44.876256', 24, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role test role(24) SQL (1.3ms) select 'x' from roles where id = 24 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:22:44.885046', 'f', NULL, NULL, '2011-04-18 11:22:44.885046', 24, 2, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.3ms) SELECT * FROM "blogs" WHERE ("blogs"."owner_firm_id" = 2)  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (0.6ms) SELECT * FROM "blogs" WHERE (name like 'ric%') AND ("blogs"."owner_firm_id" = 2)  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) and name like 'ric%')  Blog Load (0.6ms) SELECT * FROM "blogs" WHERE (name like 'ricky%') AND ("blogs"."owner_firm_id" = 2)  Blog Load (1.1ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) and name like 'ricky%')  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(24) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 24 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.2ms) DELETE FROM "role_assignments" WHERE "id" = 50 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.2ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.2ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.2ms) SELECT * FROM "users" WHERE ("users"."id" = 1)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  Permission Load (0.7ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: edit Role twiddler(3) SQL (1.1ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.7ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 'f', '2011-04-18 11:22:44.922047', NULL, NULL, '2011-04-18 11:22:44.922047', 3, NULL, 'any', 'f', 'f', 3) RETURNING "id" SQL (0.2ms) SAVEPOINT active_record_1 Permission Update (0.7ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:44.928908', "created_at" = '2011-04-18 11:22:44.922047', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 106 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:44.934025', "created_at" = '2011-04-18 11:22:44.922047', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 106 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.8ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:44.939645', "created_at" = '2011-04-18 11:22:44.922047', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 106 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.7ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:44.944571', "created_at" = '2011-04-18 11:22:44.922047', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 106 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:44.950203', "created_at" = '2011-04-18 11:22:44.922047', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 106 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.7ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:44.954568', "created_at" = '2011-04-18 11:22:44.922047', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 't', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 106 SQL (0.2ms) SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:44.960484', "created_at" = '2011-04-18 11:22:44.922047', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 106 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Firm Load (0.5ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Firm Load (0.4ms) SELECT * FROM "firms" WHERE ("firms"."id" = 4)  === permission check: edit Role twiddler(3) SQL (2.0ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.5ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 'f', '2011-04-18 11:22:45.040379', NULL, NULL, '2011-04-18 11:22:45.040379', 3, 2, 'any', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.044952', "created_at" = '2011-04-18 11:22:45.040379', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 107 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.048241', "created_at" = '2011-04-18 11:22:45.040379', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 107 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.051709', "created_at" = '2011-04-18 11:22:45.040379', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 107 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.054406', "created_at" = '2011-04-18 11:22:45.040379', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = 2 WHERE "id" = 107 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.057948', "created_at" = '2011-04-18 11:22:45.040379', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 107 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.060720', "created_at" = '2011-04-18 11:22:45.040379', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 't', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 107 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.064120', "created_at" = '2011-04-18 11:22:45.040379', "target_owned_by_self" = 'f', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 2 WHERE "id" = 107 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: edit Role twiddler(3) SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 't', '2011-04-18 11:22:45.072474', NULL, NULL, '2011-04-18 11:22:45.072474', 3, NULL, 'any', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.076682', "created_at" = '2011-04-18 11:22:45.072474', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 108 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.079856', "created_at" = '2011-04-18 11:22:45.072474', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 108 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.083111', "created_at" = '2011-04-18 11:22:45.072474', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 108 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.3ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.085642', "created_at" = '2011-04-18 11:22:45.072474', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 108 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.6ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.088796', "created_at" = '2011-04-18 11:22:45.072474', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 108 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.091760', "created_at" = '2011-04-18 11:22:45.072474', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 't', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 108 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.094951', "created_at" = '2011-04-18 11:22:45.072474', "target_owned_by_self" = 't', "target_name" = NULL, "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 108 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  === permission check: edit Role twiddler(3) SQL (1.1ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 'f', '2011-04-18 11:22:45.102588', 1, 'mertz family blog', '2011-04-18 11:22:45.102588', 3, NULL, 'any', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.106833', "created_at" = '2011-04-18 11:22:45.102588', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 109 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.110005', "created_at" = '2011-04-18 11:22:45.102588', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 109 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.113277', "created_at" = '2011-04-18 11:22:45.102588', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 109 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.115937', "created_at" = '2011-04-18 11:22:45.102588', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 109 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.119364', "created_at" = '2011-04-18 11:22:45.102588', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 109 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.122651', "created_at" = '2011-04-18 11:22:45.102588', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 't', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 109 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 3, "updated_at" = '2011-04-18 11:22:45.126558', "created_at" = '2011-04-18 11:22:45.102588', "target_owned_by_self" = 'f', "target_name" = 'mertz family blog', "has_grant_option" = 'f', "is_grant" = 'f', "target_id" = 1, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 109 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'Ricardo blog' AND "blogs"."owner_firm_id" IS NULL) LIMIT 1 SQL (0.1ms) ROLLBACK TO SAVEPOINT active_record_1 SQL (0.3ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.4ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.5ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:45.144650', '2011-04-18 11:22:45.144650', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(25) SQL (1.3ms) select 'x' from roles where id = 25 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:45.154935', '2011-04-18 11:22:45.154935', 25, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.3ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:45.166463', '2011-04-18 11:22:45.166463', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  === FAILED permission check: grok Blog mertz family blog(1) === FAILED permission check: grok Blog mertz family blog(1) SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.3ms) select 'x' from roles where id = 25 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 25)  SQL (0.5ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 'f', '2011-04-18 11:22:45.181668', 1, 'mertz family blog', '2011-04-18 11:22:45.181668', 25, NULL, 'grok', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: grok Blog mertz family blog(1) SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(25) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 25 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 51 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 52 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.3ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:45.214606', '2011-04-18 11:22:45.214606', 6, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(26) SQL (1.3ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:45.224679', '2011-04-18 11:22:45.224679', 26, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.3ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:45.235783', '2011-04-18 11:22:45.235783', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.3ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 't', '2011-04-18 11:22:45.248486', NULL, NULL, '2011-04-18 11:22:45.248486', 26, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.3ms) select 'x' from roles where id = 26 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 26)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "target_owned_by_self", "created_at", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "is_grant", "has_grant_option", "target_owner_id") VALUES('Blog', 't', '2011-04-18 11:22:45.260760', NULL, NULL, '2011-04-18 11:22:45.260760', 26, NULL, 'any', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "permissions" WHERE ("permissions".role_id = 26)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 === permission check: destroy Role test role(26) Role Destroy (0.3ms) DELETE FROM "roles" WHERE "id" = 26 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 53 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  === permission check: administer User unprivileged(5) RoleAssignment Destroy (0.3ms) DELETE FROM "role_assignments" WHERE "id" = 54 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.6ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 4 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) ROLLBACK SQL (0.1ms) BEGIN Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  User Load (0.4ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 6)  SQL (0.3ms) SELECT count(*) AS count_all FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  SQL (0.1ms) SAVEPOINT active_record_1 Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 2)  Role Load (0.4ms) SELECT "roles".id FROM "roles" WHERE ("roles"."name" = 'test role' AND "roles"."owner_firm_id" = 2) LIMIT 1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 6 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  === permission check: create Role test role() SQL (0.4ms) INSERT INTO "roles" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('test role', '2011-04-18 11:22:45.305330', '2011-04-18 11:22:45.305330', 6, 2) RETURNING "id" SQL (0.2ms) RELEASE SAVEPOINT active_record_1 === permission check: assign Role test role(27) SQL (1.3ms) select 'x' from roles where id = 27 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.5ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.5ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:45.316470', '2011-04-18 11:22:45.316470', 27, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 4)  === permission check: assign Role universal_grant(4) SQL (1.3ms) select 'x' from roles where id = 4 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'assign' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 6) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  === permission check: administer User unprivileged(5) SQL (1.2ms) select 'x' from users where id = 5 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 6 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'administer' or p.privilege = 'any') and (p.class_name = 'User') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or users.id = 6) and (p.target_id is null or users.id = p.target_id) and (p.target_owner_firm_id is null or users.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "role_assignments" ("invalid_after", "created_at", "updated_at", "role_id", "user_id", "default_user_id", "default_firm_id") VALUES(NULL, '2011-04-18 11:22:45.327893', '2011-04-18 11:22:45.327893', 4, 5, NULL, NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5)  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 3)  User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 4)  Firm Load (0.3ms) SELECT * FROM "firms" WHERE ("firms"."id" = 3)  SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 5' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 5', '2011-04-18 11:22:45.340225', '2011-04-18 11:22:45.340225', 5, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 6' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 6', '2011-04-18 11:22:45.346208', '2011-04-18 11:22:45.346208', 5, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 7' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 7', '2011-04-18 11:22:45.351851', '2011-04-18 11:22:45.351851', 3, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 8' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 8', '2011-04-18 11:22:45.357550', '2011-04-18 11:22:45.357550', 3, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 9' AND "blogs"."owner_firm_id" = 3) LIMIT 1 SQL (0.4ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 9', '2011-04-18 11:22:45.363280', '2011-04-18 11:22:45.363280', 4, 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.3ms) SELECT count(*) AS count_all FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT "blogs".id FROM "blogs" WHERE ("blogs"."name" = 'blog 10' AND "blogs"."owner_firm_id" = 2) LIMIT 1 SQL (0.5ms) INSERT INTO "blogs" ("name", "created_at", "updated_at", "owner_id", "owner_firm_id") VALUES('blog 10', '2011-04-18 11:22:45.368987', '2011-04-18 11:22:45.368987', 4, 2) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Blog Load (0.4ms) SELECT * FROM "blogs" WHERE ("blogs"."id" = 1)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.4ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:22:45.382289', 'f', NULL, NULL, '2011-04-18 11:22:45.382289', 3, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:22:45.390201', 'f', NULL, NULL, '2011-04-18 11:22:45.390201', 3, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.2ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:22:45.398043', 't', NULL, NULL, '2011-04-18 11:22:45.398043', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 SQL (1.3ms) select 'x' from roles where id = 3 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 3)  SQL (0.6ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:22:45.405612', 'f', 1, 'mertz family blog', '2011-04-18 11:22:45.405612', 3, NULL, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.4ms) SELECT count(*) AS count_all FROM "permissions" WHERE ("permissions".role_id = 27)  Permission Load (0.4ms) SELECT * FROM "permissions" WHERE ("permissions".role_id = 4)  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(27) SQL (1.3ms) select 'x' from roles where id = 27 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:22:45.420995', 'f', NULL, NULL, '2011-04-18 11:22:45.420995', 27, NULL, 'post', 'f', 'f', 3) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 27, "updated_at" = '2011-04-18 11:22:45.427993', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:22:45.420995', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 117 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 27, "updated_at" = '2011-04-18 11:22:45.437524', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:22:45.420995', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 117 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 27, "updated_at" = '2011-04-18 11:22:45.440446', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:22:45.420995', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'blurfl', "target_owner_firm_id" = NULL WHERE "id" = 117 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 27, "updated_at" = '2011-04-18 11:22:45.449746', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:22:45.420995', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 117 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 27, "updated_at" = '2011-04-18 11:22:45.452685', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:22:45.420995', "target_name" = NULL, "is_grant" = 't', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 117 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 27, "updated_at" = '2011-04-18 11:22:45.461710', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:22:45.420995', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 117 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 27, "updated_at" = '2011-04-18 11:22:45.464596', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:22:45.420995', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'any', "target_owner_firm_id" = NULL WHERE "id" = 117 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 27)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 27)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:22:45.470988', "invalid_after" = '2011-04-18 11:22:41.302327' WHERE "id" = 55 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:22:45.476533', "invalid_after" = '2011-04-17 11:22:41.303149' WHERE "id" = 55 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:22:45.481911', "invalid_after" = NULL WHERE "id" = 55 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 27)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 27)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:22:45.488152', "invalid_after" = '2011-04-19 11:22:41.303409' WHERE "id" = 55 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:22:45.511184', "invalid_after" = '2011-04-20 11:22:41.303649' WHERE "id" = 55 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:22:45.534073', "invalid_after" = NULL WHERE "id" = 55 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 27, "updated_at" = '2011-04-18 11:22:45.622327', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:22:45.420995', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = 3, "privilege" = 'post', "target_owner_firm_id" = NULL WHERE "id" = 117 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 27)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 27)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:22:45.629525', "invalid_after" = '2011-04-18 11:22:41.302327' WHERE "id" = 55 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:22:45.635089', "invalid_after" = '2011-04-17 11:22:41.303149' WHERE "id" = 55 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:22:45.640604', "invalid_after" = NULL WHERE "id" = 55 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 RoleAssignment Load (0.4ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 27)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 27)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:22:45.647217', "invalid_after" = '2011-04-19 11:22:41.303409' WHERE "id" = 55 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:22:45.670793', "invalid_after" = '2011-04-20 11:22:41.303649' WHERE "id" = 55 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.5ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.3ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:22:45.694033', "invalid_after" = NULL WHERE "id" = 55 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Blog Load (1.2ms) SELECT * FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.9ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Blog Load (0.4ms) SELECT * FROM "blogs"  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (0.1ms) SAVEPOINT active_record_1 === permission check: edit Role test role(27) Permission Destroy (0.3ms) DELETE FROM "permissions" WHERE "id" = 117 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  === permission check: edit Role test role(27) SQL (1.4ms) select 'x' from roles where id = 27 and exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'edit' or p.privilege = 'any') and (p.class_name = 'Role') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or roles.owner_id = 5) and (p.target_id is null or roles.id = p.target_id) and (p.target_owner_id is null or roles.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or roles.owner_firm_id = p.target_owner_firm_id) )  SQL (0.1ms) SAVEPOINT active_record_1 SQL (0.4ms) INSERT INTO "permissions" ("class_name", "created_at", "target_owned_by_self", "target_id", "target_name", "updated_at", "role_id", "target_owner_firm_id", "privilege", "has_grant_option", "is_grant", "target_owner_id") VALUES('Blog', '2011-04-18 11:22:45.733459', 'f', NULL, NULL, '2011-04-18 11:22:45.733459', 27, 3, 'post', 'f', 'f', NULL) RETURNING "id" SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 27, "updated_at" = '2011-04-18 11:22:45.740566', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:22:45.733459', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Role', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 118 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 27, "updated_at" = '2011-04-18 11:22:45.750273', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:22:45.733459', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 118 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 27, "updated_at" = '2011-04-18 11:22:45.753279', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:22:45.733459', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'blurfl', "target_owner_firm_id" = 3 WHERE "id" = 118 SQL (1.2ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (1.0ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 27, "updated_at" = '2011-04-18 11:22:45.762923', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:22:45.733459', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 118 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 27, "updated_at" = '2011-04-18 11:22:45.765966', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:22:45.733459', "target_name" = NULL, "is_grant" = 't', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 118 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_firm_id = p.target_owner_firm_id) ) )  Permission Load (0.8ms) SELECT * FROM "permissions" WHERE (role_id in (select role_id from role_assignments where user_id = 5 and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())))  SQL (0.1ms) SAVEPOINT active_record_1 Permission Update (0.5ms) UPDATE "permissions" SET "role_id" = 27, "updated_at" = '2011-04-18 11:22:45.775177', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:22:45.733459', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'post', "target_owner_firm_id" = 3 WHERE "id" = 118 SQL (0.2ms) RELEASE SAVEPOINT active_record_1 Permission Update (0.4ms) UPDATE "permissions" SET "role_id" = 27, "updated_at" = '2011-04-18 11:22:45.778097', "target_owned_by_self" = 'f', "created_at" = '2011-04-18 11:22:45.733459', "target_name" = NULL, "is_grant" = 'f', "has_grant_option" = 'f', "target_id" = NULL, "class_name" = 'Blog', "target_owner_id" = NULL, "privilege" = 'any', "target_owner_firm_id" = 3 WHERE "id" = 118 RoleAssignment Load (0.3ms) SELECT * FROM "role_assignments" WHERE ("role_assignments".user_id = 5 AND (role_id = 27)) LIMIT 1 SQL (0.1ms) SAVEPOINT active_record_1 User Load (0.3ms) SELECT * FROM "users" WHERE ("users"."id" = 5)  Role Load (0.3ms) SELECT * FROM "roles" WHERE ("roles"."id" = 27)  RoleAssignment Update (0.4ms) UPDATE "role_assignments" SET "updated_at" = '2011-04-18 11:22:45.783653', "invalid_after" = '2011-04-18 11:22:41.302327' WHERE "id" = 55 SQL (0.1ms) RELEASE SAVEPOINT active_record_1 SQL (1.3ms) SELECT count(*) AS count_all FROM "blogs" WHERE ( exists (select 'x' from permissions p where exists (select 'x' from role_assignments where user_id = 5 and role_assignments.role_id = p.role_id and (role_assignments.invalid_after is null or role_assignments.invalid_after > now())) and (p.privilege = 'post' or p.privilege = 'any') and (p.class_name = 'Blog') and (p.is_grant = 'f') and (p.target_owned_by_self = 'f' or blogs.owner_id = 5) and (p.target_id is null or blogs.id = p.target_id) and (p.target_owner_id is null or blogs.owner_id = p.target_owner_id) and (p.target_owner_firm_id is null or blogs.owner_