Hi Peter -

This looks like a very reasonable patch. The only thing I might ask is
that we think of a better name than "file_types", as
"Engines.file_types" doesn't really nail which its values are being
used for. My first thought was "Engines.file_types_to_mix", although
I'm definitely open to suggestions.

If you submit this as a patch to http://dev.rails-engines.org, it will
get committed in the very near future.

Thanks again!

James

On 8/21/07, Peter Bex <[EMAIL PROTECTED]> wrote:
> 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 Bex
> Solide ICT - http://www.solide-ict.nl
>
> _______________________________________________
> Engine-Developers mailing list
> [email protected]
> http://lists.rails-engines.org/listinfo.cgi/engine-developers-rails-engines.org
>
>
>


-- 
* J *
  ~
_______________________________________________
Engine-Developers mailing list
[email protected]
http://lists.rails-engines.org/listinfo.cgi/engine-developers-rails-engines.org

Reply via email to