0

私のユーザーテーブルには、所有者、管理者というブール列があります。以下は、フォームが送信されるとテーブルを更新しません。

  <%= f.check_box :owner %> 
  <%= f.label :owner %>

ログ:

Processing by UsersController#create as HTML


Parameters: {"utf8"=>"✓", "authenticity_token"=>"k0m814s9fRjCUZxeBXn5GO3o5Fq0evZG1Xc7IfUCOYU=", "user"=>{"name"=>"Bob Dylan", "email"=>"bob.dylan@gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "manager"=>"0", "owner"=>"1"}, "commit"=>"Create my account"}
Unpermitted parameters: manager, owner
   (0.2ms)  begin transaction
  User Exists (0.3ms)  SELECT 1 AS one FROM "users" WHERE LOWER("users"."email") = LOWER('bob.dylan@gmail.com') LIMIT 1
Binary data inserted for `string` type on column `password_digest`
  SQL (56.3ms)  INSERT INTO "users" ("created_at", "email", "name", "password_digest", "remember_token", "updated_at") VALUES (?, ?, ?, ?, ?, ?)  [["created_at", Thu, 06 Jun 2013 14:57:53 UTC +00:00], ["email", "bob.dylan@gmail.com"], ["name", "Bob Dylan"], ["password_digest", "$2a$10$t5hux4e.jDWS9GH7fJj7Z.gSkLehpJxzfwXOTqbnL6LA7zWZT/11S"], ["remember_token", "J-OFaVfx3a4KMGQ0Q9vttg"], ["updated_at", Thu, 06 Jun 2013 14:57:53 UTC +00:00]]
4

3 に答える 3

1

ユーザーコントローラーには、次のようなものが必要です。

def user_params
  params.require(:user).permit(:manager, :owner)
end
于 2013-06-06T14:59:23.933 に答える