# Use cattr\_accessors for Engines::Plugin defaults?

**URL:** <https://www.ruby-forum.com/t/use-cattr-accessors-for-engines-plugin-defaults/134765>\
**Category:** Engines Development\
**Created:** [April 14, 2008, 10:42pm UTC](https://www.ruby-forum.com/t/use-cattr-accessors-for-engines-plugin-defaults/134765 "2008-04-14T22:42:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sven\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5e925/32.png) [@Sven\_F](https://www.ruby-forum.com/u/Sven_F)\
**Post date:** [April 14, 2008, 10:42pm UTC](https://www.ruby-forum.com/t/use-cattr-accessors-for-engines-plugin-defaults/134765/1 "2008-04-14T22:42:53Z")

</div>

In Engines::Plugin we have:

module Engines  
class Plugin \< Rails::Plugin  
# …  
def default\_code\_paths  
%w(app/controllers app/helpers app/models components lib)  
end

which is great because now one can overwrite this in environment.rb  
(after Engines has “booted”):

Engines::Plugin.class\_eval do  
def default\_code\_paths  
%w(app/controllers app/helpers app/models app/observers  
components lib)  
end  
end

Wouldn’t it make even more sense to just use cattr\_accessors for these  
defaults?

Along the lines of:

module Engines  
class Plugin \< Rails::Plugin  
@@default\_code\_paths = %w(app/controllers app/helpers app/  
models components lib)  
cattr\_accessor :default\_code\_paths

Redefining the default\_code\_paths would then be a little less clumpsy:

Engines::Plugin.default\_code\_paths = %w(app/controllers app/helpers  
app/models app/observers components lib)

Hu?

–  
sven fuchs removed\_email\_address@domain.invalid  
artweb design [http://www.artweb-design.de](http://www.artweb-design.de)  
grünberger 65 + 49 (0) 30 - 47 98 69 96 (phone)  
d-10245 berlin + 49 (0) 171 - 35 20 38 4 (mobile)
