On Feb 24, 2008, at 8:57 AM, Sven Fuchs wrote:

> Engines' magic code mixing is mega-cool, but unfortunately it doesn't
> apply to the application controller because of the non-standard file-
> naming application.rb, which misses the "_controller" bit and doesn't
> match the regular expression in dependencies.rb.
>
> Is there a reason not to allow this feature for the application
> controller? I'd like to move quite some stuff from an application
> controller that I'm splitting up into engines ... and there's just no
> more comprehensible place to use than plugin_name/app/controllers/
> application.rb. :)
+1 but...

...this could be a major source of conflicts between engines and  
should probably be used only when nothing else works.  For example  
using a subclass of ApplicationController that all your engine  
Controllers then subclass would avoid many such conflicts.  See what I  
mean?


>
>
> So, can I apply the following?
>
> I don't think there's any potential harm resulting from this.
The patch looks harmless enough to me (with the above caveat).

Cheers,
Pascal.
--
http://blog.nanorails.com


>
>
> Thanks!
>
>
> Index: /engines/lib/engines/rails_extensions/dependencies.rb
> ===================================================================
> --- /engines/lib/engines/rails_extensions/dependencies.rb     (revision  
> 668)
> +++ /engines/lib/engines/rails_extensions/dependencies.rb     (working  
> copy)
> @@ -102,7 +102,7 @@
>        # if we recognise this type
>        # (this regexp splits out the module/filename from any
> instances of app/#{type}, so that
>        #  modules are still respected.)
> -      if file_name =~ /^(.*app\/#{file_type}s\/)?(.*_#{file_type})
> (\.rb)?$/
> +      if file_name =~ /^(.*app\/#{file_type}s\/)?(.*_#{file_type}|
> application)(\.rb)?$/
>          base_name = $2
>          # ... go through the plugins from first started to last, so
> that
>          # code with a high precedence (started later) will override
> lower precedence
>
>
>
>
>
> --
> sven fuchs                    [EMAIL PROTECTED]
> artweb design         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)
>
>
>
> _______________________________________________
> Engine-Developers mailing list
> [email protected]
> http://lists.rails-engines.org/listinfo.cgi/engine-developers-rails-engines.org

_______________________________________________
Engine-Developers mailing list
[email protected]
http://lists.rails-engines.org/listinfo.cgi/engine-developers-rails-engines.org

Reply via email to