After looking at action view source, I moved on.
I want to have a render "nav" call in my layout, and control how the "_nav"
partial is found. I have several nested controllers which may well render
the same nav. I could add another _nav in the view path, which just calls
render "full_path/nav", or I can change my controller hierarchy, but I was
looking for a way to do it so that if you have a directory structure like:
views/
widgets/
_nav.haml
components/
The render "nav" call for a components/view would check components, then go
up to widgets, and so on. The problem is, since components_controller
doesn't extend widgets_controller, the partial path for the widgets
directory isn't included.
Ideally I could have a before_filter in the controller and call:
append_partial_path "views/widgets"
This way when calling render "nav" it will check components, then widgets,
then go on up. This seems somewhat related:
https://github.com/rails/rails/pull/2045. I think partial lookup hierarchy
should follow view hierarchy rather than controller hierarchy.
--Dan
On Thu, Feb 27, 2014 at 10:45 AM, Chris McCann <[email protected]>wrote:
> Dan,
>
> Maybe some context in terms of what you're trying to accomplish would help
> spur some thinking in the group. Can you elaborate a bit?
>
> Chris
>
>
> On Friday, February 21, 2014 11:27:56 AM UTC-8, dan.simpson wrote:
>>
>> Hey All,
>>
>> When rails does a partial template look up, it seems to build a list of
>> directories based on the controller hierarchy. Does anyone know of a
>> method similar to "prepend_view_path" for partials?
>>
>> Thanks,
>> Dan
>>
> --
> --
> SD Ruby mailing list
> [email protected]
> http://groups.google.com/group/sdruby
> ---
> You received this message because you are subscribed to the Google Groups
> "SD Ruby" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
--
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
---
You received this message because you are subscribed to the Google Groups "SD
Ruby" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.