Hi all,

I've been playing in the trunk with putting stuff in different dirs  
to keep files from a reusable framework separate from the app files.


Here are a few considerations regarding the view_paths setting:

config.view_path is used to set both action_controller.view_paths and  
action_mailer.template_root. We get some buggy/unexpected behavior  
here because action_controller.view_paths can be an array or a  
string, while template_root is a single string. config.view_path can  
be set to either a string or an array, as there's basically no type  
checking, but that doesn't mean it'll work.

So borkedness ensues. For example, when set to an array, you end up  
with action_controller.view_paths being an array inside an array.  
(See line 277 of initializer.rb)

I can set config.action_controller.view_paths separately and then  
results are saner, but the way config.view_path works now is a bit  
confusing.

My suggestion is that we change config.view_path to behave more like  
config.controller_paths. First, it should be renamed to  
config.view_paths. It should have a default value of ['app/views'],  
so that one can add to it by pushing/unshifting.

Next I suggest that for consistency, action_mailer deprecates its  
template_root too, and get a view_paths just like action_controller.

The whole view_paths thing seem scarcely tested. I already filed a  
bug report with a patch at http://dev.rubyonrails.org/ticket/9258  
that fixes finding layouts.


I'd like to know from the core if my suggestions here are reasonable,  
and if a patch to rework view_paths configuration in such way would  
be welcome.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to