Loading...

engine-users@lists.rails-engines.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [Engine-users] lib folders and application controllers Tekin Suleyman Tue Feb 27 18:08:12 2007

I think my description may have not been very clear, there is infact
very little magic going on at all!

Each page has a behaviour attribute. For most pages, this is simply left
blank. If however, it is set to something, like for example, 'contact'
or 'news', when the page is rendered, extra 'stuff' is added to the
rendered page using partials.

This all works fine, all I want is for the page model to have a list of
potential behaviours - nothing more than an array of strings - which is
what I need to add to from future plugins.. Does that make sense?

I guess I could put this in the application somewhere, it just makes
sense for it to happen in the plugins.

Thanks for all the great work on engines by the way, it's made it much
easier for us to share rails code between our projects, the way it
should be.


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of James
Adam
Sent: 27 February 2007 16:32
To: Discussion of the use of existing Engines
Subject: Re: [Engine-users] lib folders and application controllers


On 2/27/07, Tekin Suleyman <[EMAIL PROTECTED]> wrote:
> Obviously this is unworkable. Is there an obvious way to modify models

> in other plugins in such a way that it get's picked up on reloads?

This is one of the occasions where you might actually want to adopt
"less magic". Is there any way you could architect it so each plugin
contributes a feature to a Page model within the application? I.E.

  class Page < AR::Base
    with_cms_features # from the cms plugin
    and_versioning # from your versioning plugin, for instance
    format_with_markdown # from your text processing plugin

    # ...

  end

The lesson learned from the login+user engine saga is: don't try to have
plugins depend on other plugins. It gets way too complicated. Is there
any way you can avoid this? I appreciate that this might really be the
advice you need at the moment; if I think of anything tonight I'll fire
of another mail to the list.

-- 
* J *
  ~
_______________________________________________
engine-users mailing list
[EMAIL PROTECTED]
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.o
rg

_______________________________________________
engine-users mailing list
[EMAIL PROTECTED]
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org