我已經安裝了Devise和CanCan,兩者似乎都在工作。我在遷移列「角色」,但是當我加入一個用戶後,檢查日誌,屋宇署查詢顯示沒有添加角色我無法將角色保存到我的設計用戶表(用於cancan)
完整的東西看起來像這樣的跡象:
Processing by Devise::RegistrationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"S+SjhxsALMbHkRBPPwOMIvHo1Bd0cNYl1g=", "user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "role"=>"receptionist"}, "commit"=>"Sign up"}
Unpermitted parameters: role
(0.2ms) begin transaction
User Exists (0.2ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = '[email protected]' LIMIT 1
Binary data inserted for `string` type on column `encrypted_password`
SQL (3.1ms) INSERT INTO "users" ("created_at", "email", "encrypted_password", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Thu, 24 Oct 2013 08:52:31 UTC +00:00], ["email", "[email protected]"], ["encrypted_password", "$2a$10$e3hKTibsZ7qSgOC5OelKgjumU8ufu46xNrBkmXcDEpix/m"], ["updated_at", Thu, 24 Oct 2013 08:52:31 UTC +00:00]]
(0.7ms) commit transaction
(0.1ms) begin transaction
Binary data inserted for `string` type on column `last_sign_in_ip`
Binary data inserted for `string` type on column `current_sign_in_ip`
SQL (0.7ms) UPDATE "users" SET "last_sign_in_at" = ?, "current_sign_in_at" = ?, "last_sign_in_ip" = ?, "current_sign_in_ip" = ?, "sign_in_count" = ?, "updated_at" = ? WHERE "users"."id" = 2 [["last_sign_in_at", Thu, 24 Oct 2013 08:52:31 UTC +00:00], ["current_sign_in_at", Thu, 24 Oct 2013 08:52:31 UTC +00:00], ["last_sign_in_ip", "127.0.0.1"], ["current_sign_in_ip", "127.0.0.1"], ["sign_in_count", 1], ["updated_at", Thu, 24 Oct 2013 08:52:31 UTC +00:00]]
(0.6ms) commit transaction
Redirected to http://0.0.0.0:3000/
Completed 302 Found in 108ms (ActiveRecord: 5.6ms)
此外,如果我編輯用戶並添加我獲取日誌中的以下錯誤
未經許可參數的作用:作用
我覺得遷移可能沒有奏效..但我可以訪問角色變量..所以我不完全理解。
我對軌相當新,所以我期待(並希望)我已經省略了一些明顯的東西。
在此先感謝
是你用導軌3還是導軌4? –
嗨,我正在使用rails 3 –