Adding has_many to Project
I'm debugging the advance roadmap plugin (http://ociotec.com/redmine/projects/advanced-roadmap). It is trying to add has_many to ProjectModel. I've never done that myself and the error messages aren't helpful so guidance is useful.
It When I do a migrate I get:
aliasing.rb:33:in `alias_method': undefined method `roadmap' for class `ProjectsController' (NameError) from /home/gap/redmine/vendor/rails/activesupport/lib/active_support/core_ext/module/aliasing.rb:33:in `alias_method_chain' from /home/gap/redmine/vendor/plugins/advanced_roadmap/lib/projects_controller_patch.rb:9:in `included'
lib/projects_controller_patch.rb is adding has_many :milestones to Project. It looks like:
require_dependency "projects_controller" module ProjectPatch def self.included(base) base.class_eval do has_many :milestones end end end
It is called from init.rb
... Dispatcher.to_prepare do begin require_dependency "application" rescue LoadError require_dependency "application_controller" end Issue.send(:include, IssuePatch) # Call ProjectPatch Project.send(:include, ProjectPatch) ProjectsController.send(:include, ProjectsControllerPatch) ProjectsHelper.send(:include, ProjectsHelperPatch) Redmine::I18n.send(:include, RedmineI18nPatch) Version.send(:include, VersionPatch) end ...
RE: Adding has_many to Project - Added by Mischa The Evil over 9 years ago
RE: Adding has_many to Project - Added by Gary Pickrell over 9 years ago
Thank you Mischa! It works!