resolve/refinerycms — Issue #1087: Decorators in engines aren't loaded
Author: phiggins
Created: 2011-10-20 18:15:43+00:00
State: open

In one of the engines I've created in my application, I added some decorators to add functionality to the Pages model and PagesController, but these weren't working when I viewed the site. Strangely they were loaded when I ran my integration specs. I had to add some code like this to get them to work:

```
class Engine < Rails::Engine
+ def self.load_decorators
+ Dir.glob(File.join(root, "app/decorators/**/*_decorator.rb")) do |c|
+ Rails.application.config.cache_classes ? require(c) : load(c)
+ end
+ end
+
+ refinery.after_inclusion &method(:load_decorators)
```

Would you accept a patch that added this to generated Refinery engines?