Forum: Ruby on Rails can partial_2 called by partail_1 access partial_1's locals?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
6f608b6766f79343062a2aa3985933dc?d=identicon&s=25 Stephen Bannasch (Guest)
on 2007-05-17 18:19
(Received via mailing list)
I have partial_2 that renders some links. It is sometimes called
directly with a :locals hash.

I also have partial_1 that renders the top and bottom of some pages
and it is also called with a :locals hash.

I'd like to be able to render partial_2 within partial_1.

This is how partial_1 is called:

<%= render(:partial => 'partial_1', :locals => {
   :authorable_object => @external_otrunk_activity,
   :authorable_object_class => ExternalOtrunkActivity,
   :all_viewable_objects => @all_viewable_external_otrunk_activities,
   :all_editable_objects => @all_editable_external_otrunk_activities })

And within partial_1 I am trying to render partial_2 and pass the
locals that partial_2 needs.

   <%= render(:partial => 'partial_2', :locals => {
     :authorable_object_class => authorable_object_class,
     :all_viewable_objects => all_viewable_objects,
     :all_editable_objects => all_editable_objects }) %>

But the locals for partial_2 appear to be nil.

Is there a way to do this?

Thanks for any help.
This topic is locked and can not be replied to.