# Engines & config

**URL:** <https://www.ruby-forum.com/t/engines-config/72325>\
**Category:** Engines Development\
**Created:** [October 16, 2006, 2:10pm UTC](https://www.ruby-forum.com/t/engines-config/72325 "2006-10-16T14:10:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nitr0z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ba9def/32.png) [@nitr0z](https://www.ruby-forum.com/u/nitr0z)\
**Post date:** [October 16, 2006, 2:10pm UTC](https://www.ruby-forum.com/t/engines-config/72325/1 "2006-10-16T14:10:28Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![nitr0z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ba9def/32.png) [@nitr0z](https://www.ruby-forum.com/u/nitr0z)\
**Post date:** [October 16, 2006, 7:01pm UTC](https://www.ruby-forum.com/t/engines-config/72325/2 "2006-10-16T19:01:10Z")

</div>

On Mon, 16 Oct 2006 13:09:15 +0100, James A. wrote:

> 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.

I think that sounds good… no reason to reinvent the wheel. The less  
weight that Engines carries, the more likely it is to see wider  
adoption.  
I’ve recently seen people who want “a plugin with views and controllers  
and  
models” but, instinctively, feel that Engines is too heavyweight. I  
obviously disagree…

Jay

---

<div class="post-metadata">

**Author:** ![nitr0z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ba9def/32.png) [@nitr0z](https://www.ruby-forum.com/u/nitr0z)\
**Post date:** [October 16, 2006, 11:57pm UTC](https://www.ruby-forum.com/t/engines-config/72325/3 "2006-10-16T23:57:47Z")

</div>

On 10/16/06, James A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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.

I love it.
