On 12/31/2005 James Adam <[EMAIL PROTECTED]> wrote:
> Continuing the WikiEngine example, intuitively you'd want to put your
> controllers underneath the WikiEngine module too. However, Rails
> automagically creates this module and throws a fit if it already
> exists. Typically within Engines/Plugins/Whatever we want to have some
> control over this module, for setting configuration options for
> example.

I've been thinking about this with some people at work, and I'm
wondering if it's possible to set up something dynamic.

I understand that the /components tree is more or less depricated, and
I'd really like to see something done with it along these lines.

For example (and I don't know exactly how feasable this is) it'd be
really useful if one could pull a whole other app into a subdir of
/components, and have Rails automatically scope it as it loads, based
on the name of that folder.

For example, /components/johns_wiki/app/models/page.rb defines Page,
but gets loaded as JohnsWiki::Page.  Same for controllers.  A few
extra routes in the parent app should handle any kind of URL munging
that would be desired.

Other stuff that would need to be looked at to get this working properly:

Database - rake migrate from the host app should investigate
components, and munge table names.  From the above example, John's
Wiki defines a table named 'pages', but the host app would translate
that into 'johns_wiki_pages'.

Tests - some way of running the components' tests from parent app's rake.

Views - if the components location was a fallback, and the default
location to look for rhtml templates was in the base /app/views, any
layouts or whatnot could be overridden to provide an integrated look
with the rest of the site.


The real question is if this is even possible, or desirable...  I
think I would much rather do something like this than get into a mess
of plugin/engine conversions from full apps.

- Jamie Macey
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to