Hello all,
So, finally (yes, yes, I know) a version of the engines plugin
approacheth targetted at edge rails (aiming at the 1.2 release). I’m
taking this opportunity to do some serious refactoring, so I thought
I’d solicit some opinions while I’m at it. There might be a few emails
like this in the very near future - feedback is appreciated.
Topic #1: Removing the ‘config’ method
I’m considering removing this method from engines as default. Or
rather, not attaching the ‘config’ method to the Module class when
engines loads. This might’ve been a bad idea since it can conflict
with the ‘config’ method of any other module out there, or even when
accessing Rails’ config via the variable supplied during plugin’s
init.rb evaluation (http://dev.rails-engines.org/tickets/187).
The purpose of the ‘config’ method was to make it simple for engine
developers to define defaults but allow users to override those
values, but I think now we might be able to adopt a more ‘Railish’
approach by using mattr_accessor instead. So, rather than
(environment.rb):
module SomeEngine
config :something,
end
Engines.start :some_engine
we might have
Engines.start :some_engine
SomeEngine.something =
The user configuration would now occur after the engines are loaded,
so that the appropriate accessors ca be defined within the engine
itself.
Obviously this change is going to break existing engines (the config
method won’t be there anymore) until they are updated, which needn’t
be immediately. Any thoughts?
James