  [1m[36mSQL (19.4ms)[0m  [1m SELECT name
 FROM sqlite_master
 WHERE type = 'table' AND NOT name = 'sqlite_sequence'
[0m
  [1m[35mSQL (0.1ms)[0m  select sqlite_version(*)
  [1m[36mSQL (1.1ms)[0m  [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
  [1m[35mSQL (0.0ms)[0m  PRAGMA index_list("schema_migrations")
  [1m[36mSQL (1.1ms)[0m  [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
  [1m[35mSQL (0.1ms)[0m   SELECT name
 FROM sqlite_master
 WHERE type = 'table' AND NOT name = 'sqlite_sequence'
  [1m[36mSQL (0.1ms)[0m  [1m SELECT name
 FROM sqlite_master
 WHERE type = 'table' AND NOT name = 'sqlite_sequence'
[0m
  [1m[35mSQL (0.1ms)[0m  SELECT "schema_migrations"."version" FROM "schema_migrations"
Migrating to CreateUsers (20101207165729)
  [1m[36mSQL (0.5ms)[0m  [1mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
  [1m[35mSQL (0.1ms)[0m  INSERT INTO "schema_migrations" ("version") VALUES ('20101207165729')
Migrating to CreateRoles (20101207165735)
  [1m[36mSQL (0.3ms)[0m  [1mCREATE TABLE "roles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
  [1m[35mSQL (0.1ms)[0m  INSERT INTO "schema_migrations" ("version") VALUES ('20101207165735')
Migrating to CreateRights (20101207165738)
  [1m[36mSQL (0.2ms)[0m  [1mCREATE TABLE "rights" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "resource" varchar(255), "operation" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
  [1m[35mSQL (0.1ms)[0m  INSERT INTO "schema_migrations" ("version") VALUES ('20101207165738')
Migrating to CreateGrants (20101207165742)
  [1m[36mSQL (0.3ms)[0m  [1mCREATE TABLE "grants" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "right_id" integer, "role_id" integer, "created_at" datetime, "updated_at" datetime) [0m
  [1m[35mSQL (0.1ms)[0m  INSERT INTO "schema_migrations" ("version") VALUES ('20101207165742')
Migrating to CreateAssignments (20101207165745)
  [1m[36mSQL (0.4ms)[0m  [1mCREATE TABLE "assignments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "role_id" integer, "created_at" datetime, "updated_at" datetime) [0m
  [1m[35mSQL (0.1ms)[0m  INSERT INTO "schema_migrations" ("version") VALUES ('20101207165745')
Migrating to CreateRecipes (20101207171917)
  [1m[36mSQL (0.3ms)[0m  [1mCREATE TABLE "recipes" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "body" text, "created_at" datetime, "updated_at" datetime) [0m
  [1m[35mSQL (0.1ms)[0m  INSERT INTO "schema_migrations" ("version") VALUES ('20101207171917')
  [1m[36mSQL (0.3ms)[0m  [1m SELECT name
 FROM sqlite_master
 WHERE type = 'table' AND NOT name = 'sqlite_sequence'
[0m
  [1m[35mSQL (0.1ms)[0m  SELECT "schema_migrations"."version" FROM "schema_migrations"
  [1m[36mSQL (0.1ms)[0m  [1m SELECT name
 FROM sqlite_master
 WHERE type = 'table' AND NOT name = 'sqlite_sequence'
[0m
  [1m[35mSQL (0.0ms)[0m  PRAGMA index_list("assignments")
  [1m[36mSQL (0.0ms)[0m  [1mPRAGMA index_list("grants")[0m
  [1m[35mSQL (0.0ms)[0m  PRAGMA index_list("recipes")
  [1m[36mSQL (0.0ms)[0m  [1mPRAGMA index_list("rights")[0m
  [1m[35mSQL (0.0ms)[0m  PRAGMA index_list("roles")
  [1m[36mSQL (0.0ms)[0m  [1mPRAGMA index_list("users")[0m
  [1m[36mSQL (0.7ms)[0m  [1m SELECT name
 FROM sqlite_master
 WHERE type = 'table' AND NOT name = 'sqlite_sequence'
[0m
  [1m[35mSQL (0.1ms)[0m   SELECT name
 FROM sqlite_master
 WHERE type = 'table' AND NOT name = 'sqlite_sequence'
  [1m[36mSQL (0.1ms)[0m  [1mSELECT "schema_migrations"."version" FROM "schema_migrations"[0m
  [1m[35mAREL (0.5ms)[0m  INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ('Bill', '2010-12-07 17:44:43.957625', '2010-12-07 17:44:43.957625')
  [1m[36mAREL (0.4ms)[0m  [1mINSERT INTO "roles" ("name", "created_at", "updated_at") VALUES ('Viewer', '2010-12-07 17:44:44.049771', '2010-12-07 17:44:44.049771')[0m
  [1m[35mAREL (0.4ms)[0m  INSERT INTO "assignments" ("user_id", "role_id", "created_at", "updated_at") VALUES (1, 1, '2010-12-07 17:44:44.060918', '2010-12-07 17:44:44.060918')
  [1m[36mAREL (0.2ms)[0m  [1mINSERT INTO "users" ("name", "created_at", "updated_at") VALUES ('Chad', '2010-12-07 17:44:44.066328', '2010-12-07 17:44:44.066328')[0m
  [1m[35mAREL (0.2ms)[0m  INSERT INTO "roles" ("name", "created_at", "updated_at") VALUES ('Author', '2010-12-07 17:44:44.068073', '2010-12-07 17:44:44.068073')
  [1m[36mAREL (0.2ms)[0m  [1mINSERT INTO "assignments" ("user_id", "role_id", "created_at", "updated_at") VALUES (1, 2, '2010-12-07 17:44:44.070114', '2010-12-07 17:44:44.070114')[0m
  [1m[35mAREL (0.3ms)[0m  INSERT INTO "rights" ("resource", "operation", "created_at", "updated_at") VALUES ('recipes', 'CREATE', '2010-12-07 17:44:44.082296', '2010-12-07 17:44:44.082296')
  [1m[36mAREL (0.2ms)[0m  [1mINSERT INTO "rights" ("resource", "operation", "created_at", "updated_at") VALUES ('recipes', 'READ', '2010-12-07 17:44:44.086967', '2010-12-07 17:44:44.086967')[0m
  [1m[35mAREL (0.2ms)[0m  INSERT INTO "rights" ("resource", "operation", "created_at", "updated_at") VALUES ('recipes', 'UPDATE', '2010-12-07 17:44:44.089158', '2010-12-07 17:44:44.089158')
  [1m[36mAREL (0.2ms)[0m  [1mINSERT INTO "rights" ("resource", "operation", "created_at", "updated_at") VALUES ('recipes', 'DELETE', '2010-12-07 17:44:44.090971', '2010-12-07 17:44:44.090971')[0m
  [1m[35mAREL (0.4ms)[0m  INSERT INTO "grants" ("right_id", "role_id", "created_at", "updated_at") VALUES (2, 1, '2010-12-07 17:44:44.139072', '2010-12-07 17:44:44.139072')
  [1m[36mAREL (0.2ms)[0m  [1mINSERT INTO "grants" ("right_id", "role_id", "created_at", "updated_at") VALUES (1, 2, '2010-12-07 17:44:44.145447', '2010-12-07 17:44:44.145447')[0m
  [1m[35mAREL (0.2ms)[0m  INSERT INTO "grants" ("right_id", "role_id", "created_at", "updated_at") VALUES (2, 2, '2010-12-07 17:44:44.147520', '2010-12-07 17:44:44.147520')
  [1m[36mAREL (0.2ms)[0m  [1mINSERT INTO "grants" ("right_id", "role_id", "created_at", "updated_at") VALUES (3, 2, '2010-12-07 17:44:44.150388', '2010-12-07 17:44:44.150388')[0m
  [1m[35mAREL (0.2ms)[0m  INSERT INTO "grants" ("right_id", "role_id", "created_at", "updated_at") VALUES (4, 2, '2010-12-07 17:44:44.152677', '2010-12-07 17:44:44.152677')


Started GET "/recipes" for 127.0.0.1 at 2010-12-07 10:45:17 -0700

SyntaxError (/Users/chad/src/rr2/Book/code/rr2/role_based_authorization/app/controllers/application_controller.rb:16: syntax error, unexpected $end, expecting keyword_end):
  app/controllers/recipes_controller.rb:1:in `<top (required)>'

Rendered /Users/chad/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.1ms)
Rendered /Users/chad/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (4.5ms)
Rendered /Users/chad/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (9.2ms)


Started GET "/recipes" for 127.0.0.1 at 2010-12-07 10:45:33 -0700
  Processing by RecipesController#index as HTML
Completed   in 0ms

RuntimeError (recipes):
  app/controllers/application_controller.rb:8:in `check_authorization'

Rendered /Users/chad/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
Rendered /Users/chad/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.2ms)
Rendered /Users/chad/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (6.1ms)


Started GET "/recipes" for 127.0.0.1 at 2010-12-07 10:46:05 -0700
  Processing by RecipesController#index as HTML
Completed   in 1ms

NameError (undefined local variable or method `action' for #<RecipesController:0x00000102403000>):
  app/controllers/application_controller.rb:8:in `check_authorization'

Rendered /Users/chad/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.1ms)
Rendered /Users/chad/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.1ms)
Rendered /Users/chad/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (6.2ms)


Started GET "/recipes" for 127.0.0.1 at 2010-12-07 10:46:16 -0700
  Processing by RecipesController#index as HTML
Completed   in 0ms

RuntimeError (["recipes", "index", "recipes"]):
  app/controllers/application_controller.rb:8:in `check_authorization'

Rendered /Users/chad/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
Rendered /Users/chad/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (2.2ms)
Rendered /Users/chad/.rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (6.0ms)
  [1m[36mUser Load (0.9ms)[0m  [1mSELECT "users".* FROM "users"[0m
  [1m[35mUser Load (0.4ms)[0m  SELECT "users".* FROM "users" LIMIT 1
  [1m[36mRole Load (1.9ms)[0m  [1mSELECT "roles".* FROM "roles" INNER JOIN "assignments" ON "roles".id = "assignments".role_id WHERE (("assignments".user_id = 1))[0m
  [1m[35mGrant Load (0.3ms)[0m  SELECT "grants".* FROM "grants" WHERE ("grants".role_id IN (1,2))
  [1m[36mRight Load (0.3ms)[0m  [1mSELECT "rights".* FROM "rights" WHERE ("rights"."id" IN (2,1,3,4))[0m
  [1m[36mUser Load (0.6ms)[0m  [1mSELECT "users".* FROM "users" LIMIT 1[0m
  [1m[35mRole Load (0.3ms)[0m  SELECT "roles".* FROM "roles" INNER JOIN "assignments" ON "roles".id = "assignments".role_id WHERE (("assignments".user_id = 1))
  [1m[36mGrant Load (0.3ms)[0m  [1mSELECT "grants".* FROM "grants" WHERE ("grants".role_id IN (1,2))[0m
  [1m[35mRight Load (0.3ms)[0m  SELECT "rights".* FROM "rights" WHERE ("rights"."id" IN (2,1,3,4))
  [1m[36mUser Load (0.4ms)[0m  [1mSELECT "users".* FROM "users" LIMIT 1[0m
  [1m[35mSQL (0.3ms)[0m   SELECT name
 FROM sqlite_master
 WHERE type = 'table' AND NOT name = 'sqlite_sequence'
  [1m[36mRole Load (0.3ms)[0m  [1mSELECT "roles"."id" AS t0_r0, "roles"."name" AS t0_r1, "roles"."created_at" AS t0_r2, "roles"."updated_at" AS t0_r3, "rights"."id" AS t1_r0, "rights"."resource" AS t1_r1, "rights"."operation" AS t1_r2, "rights"."created_at" AS t1_r3, "rights"."updated_at" AS t1_r4 FROM "roles" LEFT OUTER JOIN "grants" ON "roles"."id" = "grants"."role_id" LEFT OUTER JOIN "rights" ON "rights"."id" = "grants"."right_id" INNER JOIN "assignments" ON "roles".id = "assignments".role_id WHERE (("assignments".user_id = 1)) AND (rights.operation = 'CREATE')[0m
  [1m[35mUser Load (0.3ms)[0m  SELECT "users".* FROM "users" LIMIT 1
  [1m[36mUser Load (0.3ms)[0m  [1mSELECT "users".* FROM "users" LIMIT 1[0m
  [1m[35mRole Load (0.3ms)[0m  SELECT "roles"."id" AS t0_r0, "roles"."name" AS t0_r1, "roles"."created_at" AS t0_r2, "roles"."updated_at" AS t0_r3, "rights"."id" AS t1_r0, "rights"."resource" AS t1_r1, "rights"."operation" AS t1_r2, "rights"."created_at" AS t1_r3, "rights"."updated_at" AS t1_r4 FROM "roles" LEFT OUTER JOIN "grants" ON "roles"."id" = "grants"."role_id" LEFT OUTER JOIN "rights" ON "rights"."id" = "grants"."right_id" INNER JOIN "assignments" ON "roles".id = "assignments".role_id WHERE (("assignments".user_id = 1)) AND (rights.operation = 'CREATE' AND resource = 'recipes')
  [1m[36mUser Load (0.5ms)[0m  [1mSELECT "users".* FROM "users" LIMIT 1[0m
  [1m[35mRole Load (0.3ms)[0m  SELECT "roles".* FROM "roles" INNER JOIN "assignments" ON "roles".id = "assignments".role_id WHERE (("assignments".user_id = 1))
  [1m[36mGrant Load (0.4ms)[0m  [1mSELECT "grants".* FROM "grants" WHERE ("grants".role_id IN (1,2))[0m
  [1m[36mUser Load (0.6ms)[0m  [1mSELECT "users".* FROM "users" LIMIT 1[0m
  [1m[35mRole Load (0.3ms)[0m  SELECT "roles".* FROM "roles" INNER JOIN "assignments" ON "roles".id = "assignments".role_id WHERE (("assignments".user_id = 1))
  [1m[36mGrant Load (0.3ms)[0m  [1mSELECT "grants".* FROM "grants" WHERE ("grants".role_id IN (1,2))[0m
  [1m[35mUser Load (0.4ms)[0m  SELECT "users".* FROM "users" LIMIT 1
  [1m[36mUser Load (0.4ms)[0m  [1mSELECT "users".* FROM "users" LIMIT 1[0m
  [1m[35mSQL (0.2ms)[0m   SELECT name
 FROM sqlite_master
 WHERE type = 'table' AND NOT name = 'sqlite_sequence'
  [1m[36mRole Load (0.2ms)[0m  [1mSELECT "roles"."id" AS t0_r0, "roles"."name" AS t0_r1, "roles"."created_at" AS t0_r2, "roles"."updated_at" AS t0_r3, "rights"."id" AS t1_r0, "rights"."resource" AS t1_r1, "rights"."operation" AS t1_r2, "rights"."created_at" AS t1_r3, "rights"."updated_at" AS t1_r4 FROM "roles" LEFT OUTER JOIN "grants" ON "roles"."id" = "grants"."role_id" LEFT OUTER JOIN "rights" ON "rights"."id" = "grants"."right_id" INNER JOIN "assignments" ON "roles".id = "assignments".role_id WHERE (("assignments".user_id = 1)) AND (rights.operation = 'CREATE' AND resource = 'recipes')[0m
  [1m[35mUser Load (0.4ms)[0m  SELECT "users".* FROM "users" LIMIT 1
  [1m[36mSQL (0.3ms)[0m  [1mSELECT COUNT(DISTINCT "roles"."id") FROM "roles" LEFT OUTER JOIN "grants" ON "roles"."id" = "grants"."role_id" LEFT OUTER JOIN "rights" ON "rights"."id" = "grants"."right_id" INNER JOIN "assignments" ON "roles".id = "assignments".role_id WHERE (("assignments".user_id = 1)) AND (rights.operation = 'CREATE' AND resource = 'recipes')[0m
  [1m[35mUser Load (0.4ms)[0m  SELECT "users".* FROM "users" ORDER BY users.id DESC LIMIT 1
  [1m[36mSQL (0.4ms)[0m  [1mSELECT COUNT(DISTINCT "roles"."id") FROM "roles" LEFT OUTER JOIN "grants" ON "roles"."id" = "grants"."role_id" LEFT OUTER JOIN "rights" ON "rights"."id" = "grants"."right_id" INNER JOIN "assignments" ON "roles".id = "assignments".role_id WHERE (("assignments".user_id = 2)) AND (rights.operation = 'CREATE' AND resource = 'recipes')[0m
  [1m[36mUser Load (0.5ms)[0m  [1mSELECT "users".* FROM "users" LIMIT 1[0m
  [1m[35mSQL (0.2ms)[0m   SELECT name
 FROM sqlite_master
 WHERE type = 'table' AND NOT name = 'sqlite_sequence'
  [1m[36mSQL (0.2ms)[0m  [1mSELECT COUNT(DISTINCT "roles"."id") FROM "roles" LEFT OUTER JOIN "grants" ON "roles"."id" = "grants"."role_id" LEFT OUTER JOIN "rights" ON "rights"."id" = "grants"."right_id" INNER JOIN "assignments" ON "roles".id = "assignments".role_id WHERE (("assignments".user_id = 1)) AND (rights.operation = 'CREATE' AND resource = 'recipes')[0m
  [1m[35mUser Load (0.4ms)[0m  SELECT "users".* FROM "users" ORDER BY users.id DESC LIMIT 1
  [1m[36mSQL (0.4ms)[0m  [1mSELECT COUNT(DISTINCT "roles"."id") FROM "roles" LEFT OUTER JOIN "grants" ON "roles"."id" = "grants"."role_id" LEFT OUTER JOIN "rights" ON "rights"."id" = "grants"."right_id" INNER JOIN "assignments" ON "roles".id = "assignments".role_id WHERE (("assignments".user_id = 2)) AND (rights.operation = 'CREATE' AND resource = 'recipes')[0m
  [1m[36mUser Load (0.6ms)[0m  [1mSELECT "users".* FROM "users" LIMIT 1[0m
  [1m[35mSQL (0.1ms)[0m  SELECT COUNT(*) FROM "roles" INNER JOIN "assignments" ON "roles".id = "assignments".role_id WHERE (("assignments".user_id = 1)) AND (rights.operation = 'CREATE' AND resource = 'recipes')
SQLite3::SQLException: no such column: rights.operation: SELECT COUNT(*) FROM "roles" INNER JOIN "assignments" ON "roles".id = "assignments".role_id WHERE (("assignments".user_id = 1)) AND (rights.operation = 'CREATE' AND resource = 'recipes')
  [1m[36mUser Load (0.5ms)[0m  [1mSELECT "users".* FROM "users" LIMIT 1[0m
  [1m[35mSQL (0.2ms)[0m   SELECT name
 FROM sqlite_master
 WHERE type = 'table' AND NOT name = 'sqlite_sequence'
  [1m[36mSQL (0.2ms)[0m  [1mSELECT COUNT(DISTINCT "roles"."id") FROM "roles" LEFT OUTER JOIN "grants" ON "roles"."id" = "grants"."role_id" LEFT OUTER JOIN "rights" ON "rights"."id" = "grants"."right_id" INNER JOIN "assignments" ON "roles".id = "assignments".role_id WHERE (("assignments".user_id = 1)) AND (rights.operation = 'CREATE' AND resource = 'recipes')[0m
  [1m[35mUser Load (0.5ms)[0m  SELECT "users".* FROM "users" ORDER BY users.id DESC LIMIT 1
  [1m[36mSQL (0.3ms)[0m  [1mSELECT COUNT(DISTINCT "roles"."id") FROM "roles" LEFT OUTER JOIN "grants" ON "roles"."id" = "grants"."role_id" LEFT OUTER JOIN "rights" ON "rights"."id" = "grants"."right_id" INNER JOIN "assignments" ON "roles".id = "assignments".role_id WHERE (("assignments".user_id = 2)) AND (rights.operation = 'CREATE' AND resource = 'recipes')[0m
  [1m[35mUser Load (0.4ms)[0m  SELECT "users".* FROM "users" LIMIT 1
  [1m[36mSQL (0.6ms)[0m  [1m SELECT name
 FROM sqlite_master
 WHERE type = 'table' AND NOT name = 'sqlite_sequence'
[0m
  [1m[35mUser Load (0.4ms)[0m  SELECT "users".* FROM "users" LIMIT 1
  [1m[36mSQL (0.4ms)[0m  [1m SELECT name
 FROM sqlite_master
 WHERE type = 'table' AND NOT name = 'sqlite_sequence'
[0m
  [1m[35mUser Load (0.3ms)[0m  SELECT "users".* FROM "users" LIMIT 1
  [1m[36mRole Load (0.3ms)[0m  [1mSELECT "roles".* FROM "roles" INNER JOIN "assignments" ON "roles".id = "assignments".role_id WHERE (("assignments".user_id = 1))[0m
