Hi engines developers,
I’m working on a project that uses Cells extensively
(http://nick.smt.de/trac/nick/wiki/Cells). Cells relies on Engines in
turn. I hit a wall when I tried to make cells load a class tree of
cells
This was caused by the way Cells works, but I will not bother you with
the boring details of that.
I decided to rework the way cells loads its classes, and the best way to
do
this is via the autoload dependencies system, which is overridden by
Engines.
This requires that the correct file is loaded not only when the user
refers
to FooController (from controllers/foo_controller.rb), but also when the
user refers to FooCell (from cells/foo_cell.rb).
This can be done by copying over the entire
require_or_load_with_engine_additions and adding ‘cell’ to the
file_types,
but that would be silly and very un-DRY. Instead, I propose this patch
(see attachment). It adds a new mattr_accessor Engines.file_types which
defaults to [‘controller’, ‘helper’]. Cells then adds to this so it
reads
[‘controller’, ‘helper’, ‘cell’] and hacks the load paths in such a way
that the correct load paths are looked up.
In my opinion, this small patch paves the way for other cell-like
extensions
to Rails, so I would like to see this integrated in Engines.
Comments? Suggestions?
Regards,
Peter B.
Solide ICT - http://www.solide-ict.nl