Actions
Patch #4665
openProjects not calling EnabledModule callbacks in some cases
Status:
New
Priority:
Normal
Assignee:
-
Category:
Projects
Target version:
-
Start date:
2010-01-27
Due date:
% Done:
0%
Estimated time:
Description
Implementation of Project.enabled_module_names= still calls modules.clear() in some cases (if nil is passed as parameter).
This has the risk of not invoking module callbacks (before_create, after_create, before_destroy, after_destroy) correctly.
Proposed change is to remove all traces of modules.clear(). Example:
def enabled_module_names=(module_names=[]) module_names = module_names.collect(&:to_s) # remove disabled modules enabled_modules.each {|mod| mod.destroy unless module_names.include?(mod.name)} # add new modules module_names.reject {|name| module_enabled?(name)}.each {|name| enabled_modules << EnabledModule.new(:name => name)} end
Regards!
Actions