Project

General

Profile

Redmine2 - Plugins application_controller

Added by Alexander Monteiro almost 12 years ago

Hi,

Im changing my plugin to works with Redmine 2.0 and Im getting some problems with its application controller that doesn't works anymore.

application_controller.rb

class ApplicationController < ActionController::Base
  before_filter :getPluginFolderName
  protect_from_forgery

  def getPluginFolderName
      @PluginFolderName = 'redmine_monitoring_controlling' unless @PluginFolderName = File.dirname(__FILE__).gsub(File.join(Rails.root.to_s,'plugins'),'').split('/')[1]    
  end

end

I tried use unloadable and layout 'base' parameters but still doesn't work.

Any suggestion?


Replies (1)

RE: Redmine2 - Plugins application_controller - Added by Daniel Munn almost 12 years ago

Hi Alexander

What you'll probably find when your controllers inherit ApplicationController, is that they're inheriting the one from the Redmine base. When I've needed to work with this functionality I've ended up wrapping bits in modules to prevent clashes.

EG:

class ClassModule::ApplicationController < ApplicationController
end

Then have your controllers inherit from the ApplicationController in a module, just a suggestion :)

    (1-1/1)