Content
Redmine/chiliproject migration problems - "changes is defined by ActiveRecord" ActiveRecord::DangerousAttributeError
Added by Denis Lamotte almost 11 years ago
Hi all,
i have decide to convert a few redmine and chiliproject to openproject the latest branch.
i use the latest version of openproject 3 with all the following plugins:
Gemfile.plugins gem "openproject-plugins", :git => "https://github.com/opf/openproject-plugins.git", :branch => "dev" gem "openproject-meeting", git: "https://github.com/finnlabs/openproject-meeting.git", :branch => "dev" gem "openproject-pdf_export", git: "https://github.com/finnlabs/openproject-pdf_export", :branch => "dev" gem "openproject-backlogs", git: "https://github.com/finnlabs/openproject-backlogs.git", :branch => "dev" gem "pdf-inspector", "~>1.0.0" gem "openproject-global_roles", git: "https://github.com/finnlabs/openproject-global_roles.git", :branch => "dev" gem "openproject-costs", git: "https://github.com/finnlabs/openproject-costs.git", :branch => "dev" gem "prawn"
i have no problem with the bundle or whatosever, the seeded project seems to work fine. BUT
The migration from the existing data does not work, so i begin to create my own sql migration file to match all table generated after a standard migration.
Most of the projects works except when i try o update a work_package i receive the following error:
*ActiveRecord::DangerousAttributeError in WorkPackagesController#update* changes is defined by ActiveRecord app/models/journal_manager.rb:154:in `create_journal' app/models/journal_manager.rb:137:in `add_journal' lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/save_hooks.rb:69:in `save_journals' app/models/work_package.rb:423:in `update_by!' app/controllers/work_packages_controller.rb:181:in `update'
i’m using ruby-2.0.0-p247 with rails 3.2.16 and all gemset defined in the Gemfile.
i add the full stack trace, the migration file i apply on the original chili project dump and the resulting dump struct.
Any idea cause i’m stuck there :-) !!
Best regards
Replies (2)
hi Denis,
since you are migrating an old plugin I’m confident that your issue has to do with OpenProject renaming the `changes` attribute to `changed_data` due to naming conflicts with ActiveRecord. The relevant commit is here: https://github.com/opf/openproject/commit/70a63a6
what you need to do: you basically need to rename all occurrences of `Journal#changes` to `Journal#changed_data`. Usually the `changed_data` attribute is filtered out in `create_journal`, see here https://github.com/opf/openproject/blob/dev/app/models/journal_manager.rb#L145
but since you are providing the old `#changes` attribute, it’s not filtered out and passed directly to ActiveRecord which doesn’t like it (anymore).
if you have no control over the naming of the `changes` attribute, then we probably need additional information about the plugin you’re migrating in order to help you more.
Thanks for your effort of migrating plugins to OpenProject! That’s very cool and you can expect further support here in the forums.
Thanks :-)