Refactor #14093
closedRemove unused roles permissions column
Description
The roles table has a permissions text column that pre-#812 was a serialised list of permissions assigned to the role. #812 changed this so that permissions are associated via filters, and permissions
is now an has_many association through filters, but the column wasn't removed in that patch.
The presence of the column was causing a test failure on Rails 4.2 because it has the same name as the association.
--- expected +++ actual @@ -1 +1 @@ -#<ActiveRecord::Associations::CollectionProxy []> +#<ActiveRecord::Associations::CollectionProxy [#<Permission id: 769440046, name: "view_ptables", resource_type: "Ptable", created_at: "2013-12-04 08:41:05", updated_at: "2013-12-04 08:41:05">]> (Minitest::Assertion) /var/lib/workspace/workspace/test_develop_pr_core/database/mysql/label/fast/ruby/2.2/test/functional/roles_controller_test.rb:82
Under MySQL, the column has a limit of 64k characters, which validates_lengths_from_database enforces. In the, it created a Role then called #add_permissions! on it, but calling .permissions after would return an empty array on MySQL (not other DBs).
The length validation on the permissions
field was called when the role was first created, and this caused the permissions
association to be cached by Rails. Reloading the association worked, but also removing the identically named and unused attribute also prevents the validation messing with the association.
Updated by Dominic Cleal almost 9 years ago
- Blocks Feature #13244: Upgrade Ruby on Rails to 4.2 added
Updated by The Foreman Bot almost 9 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/3289 added
Updated by Dominic Cleal almost 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 1657a147e61f74be373a86efea63bd9584ece748.
Updated by Dominic Cleal almost 9 years ago
- Translation missing: en.field_release set to 136