Actions
Bug #4537
closedUnsetting roles via API does not work
Description
When user tries to set empty array of role_ids, he receives
{ "error": { "message": "undefined method `uniq' for nil:NilClass" } }
Started PUT "/foreman/api/users/13" for 127.0.0.1 at 2014-03-04 09:40:34 +0100 Processing by Api::V1::UsersController#update as JSON Parameters: {"user"=>{"login"=>"somelogin", "role_ids"=>nil}, "apiv"=>"v1", "id"=>"13"} User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 1]] Setting current user thread-local variable to admin User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."login" = '13' ORDER BY firstname LIMIT 1 User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 13 ORDER BY firstname LIMIT 1 (0.2ms) BEGIN (0.1ms) ROLLBACK undefined method `uniq' for nil:NilClass (NoMethodError) /home/ares/Projekty/Zdrojaky/foreman/app/models/user.rb:272:in `role_ids_with_change_detection='
Actions