On 3/6/06, Åukasz Piestrzeniewicz [email protected] wrote:
Now, as RcssController does contain some meaningful code and is
identical (or similar) on all deployments it would be nice to make it
part of distribution. And right now the only clean way of providing
controllers to existing applications is to create an Engine.
I believe that with the new dependency loading mechanism coming in
Rails 1.1 you can provide a controller as part of a plugin without
using engines - all you need is to place the controller somewhere in
the load path. For instance, I just tried this out:
/vendor/plugins/test_plugin/
|- lib
|- test_controller.rb
which contains:
class TestController < ApplicationController
def index; render :text => ‘Get your ass to Mars!’; end
end
This works from the url http://localhost:3000/test/index, so I don’t
think that in this case RCSS needs to be an engine.
That said, you still can’t load views, routes, migrations, static web
assets (images, stylesheets, javascripts) or plenty of other stuff
from plugins, nor can you easily override only a small part of a
controller included in this way (without using subclassing, but that
might make sense in some circumstances, to be fair).
On 3/5/06, Raphael S. [email protected] wrote:
If possible, I’d like to try and not get any Engine whatsoever into my application.
Just doesn’t feel right. A plugin, like Markaby, would be great though
I’m aware that some people think that engines ‘smell bad’ (and of
course everyone has a right to their opinion, however they have
derived it), but until Rails supports loading those types of files
from arbitrary locations, the Engines plugin will strive to fill that
gap for those people (me, certainly) who find it useful or even
necessary to isolate and/or share parts of their applications using
plugin-style entities. The emphasis there is on ‘plugin’.
If you think that to any extent that type of behaviour might be useful
and should be provided by the Rails ‘out of the box’, send a message
to rails-core asking them to look into it. Nothing would make me
happier; reflecting the Rails philosophy, it would mean less code for
me to write
james