All,
I have a RXML template which renders partial RXML templates within it.
A snippet is below. The “xml” variable is the parent template’s Builder
variable. It is passed into the partial under the name “parent_xml”.
Why can’t I use :locals => {… :xml => xml …} in my call to render
the partial? It seems like if I do use :xml => xml, it doesn’t work,
and I am forced to pass into a local variable with a name other than
“xml”, for example, “parent_xml”.
Thanks,
Wes
========== snippet of main template ================
xml.tbody do
objects.each do |obj|
xml.tr do
render(:partial => ‘common/list_buttons_display’,
:layout => false,
:locals => {:parent_xml => xml,
:buttons => buttons,
:obj => obj}) if buttons_first
========== snippet of RXML partial ================
columns.each do |col_array|
attr_name = col_array[0]
column_display_name = col_array[1]
value = eval(“obj.#{attr_name}”)
column_contents = (column_display_name == ‘Fax Number’ ?
number_to_phone(value, {:area_code => true}) :
value)
parent_xml.td(column_contents, :id => “#{obj.id}_#{attr_name}”)
end