redmine development - overide model getter

Added by eyal R about 6 years ago

Hi all,
I'm trying to overide model getter but I don't want to restart my application while I debug.
I am using Dispatcher.to_prepare and see the debugger go to the "Issue.send" line every time but I keep getting the same value (ex. changing 50 to 60 then refresh doesn't change the value...)

my setup:
Windows 7 , netbeans 7.0.1 , ruby 1.8.7 , rails 2.3.14 , redmine 1.2.2 , ruby-debug-ide 0.4.16 , mongrel 1.1.5
developmemt mode
config.cache_classes = false
config.action_controller.perform_caching = false

my code:

module RedmineDoneRatioFix
  module IssuePatch
    def self.included(base)
      base.class_eval do     
        def done_ratio
          50
        end
      end
    end
  end
end

require 'redmine'
require 'dispatcher'

Dispatcher.to_prepare :redmine_done_ratio_fix do
  Issue.send(:include, RedmineDoneRatioFix::IssuePatch)
end

link to my stack overflow question:

http://stackoverflow.com/questions/8340904/ruby-on-rails-debugging-redmine

Please help me.

Replies (1)

RE: redmine development - overide model getter - Added by Mischa The Evil about 6 years ago

Should be fixed as follows (answer given by the initial author over at stackoverflow):

Adding unloadable solved it:

module RedmineDoneRatioFix
  module IssuePatch
    def self.included(base) 
      unloadable
      base.class_eval do     
        def done_ratio
         50
        end
      end
    end
  end
end

(1-1/1)