Using Role::PermissionsAttributeCoder makes migration from 1.4 lose role permissions
|Category:||Permissions and roles|
In 1.4 permissions are serialized as
--- - !ruby/sym add_project - !ruby/sym edit_project
fails to load it. next thing it is saved empty.
#2 Updated by David Escala almost 4 years ago
This is the old environment from which the database is coming from:
Ruby version 1.8.7 (x86_64-linux) RubyGems version 1.8.24 Rails version 2.3.17 Database adapter mysql
And this is the target environment:
Redmine version 2.4.2.stable Ruby version 1.9.3-p194 (2012-04-20) [x86_64-linux] Rails version 3.2.16 Database adapter Mysql2
In the old environment a Symbol object is serialized as
>> :add_project.to_yaml => "--- !ruby/sym add_project"
>> :add_project.to_yaml => "--- :add_project\n"
I don't know the reason of this difference, though both are valid YAML representations of a Symbol object.
#3 Updated by David Escala almost 4 years ago
My setup is serializing this way because it uses a plugin which replaces YAML with ZAML
To avoid hitting this bug use this patch
--- a/app/models/role.rb +++ b/app/models/role.rb @@ -58,7 +58,7 @@ class Role < ActiveRecord::Base has_many :members, :through => :member_roles acts_as_list - serialize :permissions, ::Role::PermissionsAttributeCoder + serialize :permissions attr_protected :builtin validates_presence_of :name