Forum: Rails Engines development Changing code mixing order

9a183854c4b3cade3d5dd067f457ecfe?d=identicon&s=25 mateo murphy (Guest)
on 2008-03-07 20:49
(Received via mailing list)
Hi all,

In my latest project, I had a need to have code in a plugin override
the code in the app (rather than the usual way) so I modified a couple
of files to allow that. I was wondering if this was a feature that
anyone else was interested in? If so I could submit a patch.

There is one thing I wasn't entirely sure about, however. In
plugin.rb, in the add_plugin_view_paths method, there's the following
line of code:

  ActionController::Base.view_paths.insert(1, view_path) # push it
just underneath the app

Is there a particular reason why the the view_path is inserted right
after the app's, rather than at the end of the array?

thanks

mateo
57ca262d3f80efadc5163d5e1875c1ee?d=identicon&s=25 Todd Nine (Guest)
on 2008-03-07 21:18
(Received via mailing list)
I'm interested in this functionality.  Specifically, I'm more interested
in
a decorator where I can insert links to my new plugin into existing
views.
That way I can make the UI intuitive, but I don't have to hack the core
app's code.
9a183854c4b3cade3d5dd067f457ecfe?d=identicon&s=25 mateo murphy (Guest)
on 2008-03-08 05:08
(Received via mailing list)
I've thought of doing exactly that, but I'm not sure adding the
functionality into engines is the best idea. Maybe in a
separate/complimentary plugin?

In any case, using hpricot http://code.whytheluckystiff.net/hpricot/
should make it pretty trivial
9a183854c4b3cade3d5dd067f457ecfe?d=identicon&s=25 mateo murphy (Guest)
on 2008-03-08 23:40
(Received via mailing list)
Hi,

I've written some code to do just that, but there are a couple of
points I'm not certain about; for one, where should this decorator
code exist? Right now I have it as a class within the relevant helper
module (i.e. TestHelper::Decorator) where you write methods of the
same name as the actions you want to manipulate. However I'm not
entirely sure that's the best approach... what do you think?

Apologies if this is not completely relevant to this list, we can take
the discussion elsewhere if need be
This topic is locked and can not be replied to.