Project

General

Profile

Extending the Redmine's controllers

Added by Yegor Veter almost 15 years ago

Hello all,

I'm trying to extend the issues_controller (Redmine 0.8.7) by wrapping its index method to extract some additional info for me. I've done the method wrapping in my models before, and it all worked as a breeze. With controllers, I seem to be missing something:

Here's my lib/issues_controller_patch.rb:

module IssuesControllerPatch
  def self.included(base) # :nodoc:
    base.send(:include, InstanceMethods)
     base.class_eval do
      alias_method_chain :index, :folders_pane     
    end
  end

  module InstanceMethods
    def index_with_folders_pane
      @folders = Folder.find_visible(User.current)
      return index_without_folders_pane
    end
  end
end

IssuesController.send(:include, IssuesControllerPatch)

As soon as I require the above file from my init.rb, I'm getting "uninitialized constant ApplicationController". I tried adding require 'application' to the top of init.rb, but this gets me into the dependency hell: first it wants gravatar, if I add that it is asking for session_store, then rfpdf - looks like I'm barking up the wrong tree.

Did anyone here had any success extending the redmine controllers? Any help on the matter will be appreciated greatly!