#375 √ resolved
Carl Lerche

Modules included in Helper modules won't be included

Reported by Carl Lerche | June 15th, 2008 @ 11:35 PM | in 0.9.4

Here's the problem. Merb::BootLoader::LoadClasses loads controllers before helpers.

In AbstractController, there is the following:

def inherited(klass)
      _abstract_subclasses << klass.to_s
      helper_module_name = klass.to_s =~ /^(#|Merb::)/ ? "#{klass}Helper" : "Merb::#{klass}Helper"
      Object.make_module helper_module_name
      klass.class_eval <<-HERE
        include Object.full_const_get("#{helper_module_name}") rescue nil
      HERE
      super
    end

This creates the helper module for the controller and includes it into the controller before the helpers even get loaded. This causes two problems.

  1. The included class method in the module will never get called because the module was already included
  2. Any module that is included in the helper module will not get included into the controller because the Helper module is already included into the controller.

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket