blog.eliotsykes.com

Icon

Fixing “A copy of ApplicationHelper has been removed from the module tree but is still active”

I found a few Ruby on Rails questions posted that ask how to fix “A copy of ApplicationHelper has been removed from the module tree but is still active” errors, unfortunately none seemed to have solutions.

So unluckily I got this error yesterday (in development environment only) with Rails 2.1.x.

I narrowed it down to a method I’d added to ApplicationHelper which used a class method on an HtmlUtil module I’d written.

The new method in ApplicationHelper is as follows:

module ApplicationHelper
  ...
  def title
    HtmlUtil.escape_html page_title
  end
  ...
end

The problem was only the first request after a server restart would work.  Subsequent requests would give the “A copy of ApplicationHelper has been removed from the module tree but is still active” error message.

To fix it I ‘require’d the HtmlUtil at the top of ApplicationHelper:

require 'html_util'
module ApplicationHelper
  ...
end

So, if you’re getting this error, you may be using another module in your ApplicationHelper. Try to fix it by requiring the module at the top of the helper.

Category: Uncategorized

Tagged:

2 Responses

  1. check this, it might help, I had the same problem, and adding unloadable to my plugins application controller helped.

    http://dev.rubyonrails.org/ticket/6001

  2. Eliot says:

    Thanks CrazyScopio, I think I may have read somewhere that unloadable is deprecated but may be wrong on that…regardless very helpful, especially for those of us using older rails versions, cheers.

Leave a Reply

Who’s Blog?



Hello, I’m Eliot Sykes and this is my blog. Thank you for visiting. I'm the Founder of MissedConnections.com


Read about my current projects, contact me or find me on github