0
- content_for :logo, render('logo', :obj => @sites_page)

raise在 _logo.html.haml

-raise local_variables.inspect
= link_to popup_information_path(obj.class.short_name, obj), :remote => true do
    - image_tag(obj.user.avatar.url)

表明局部变量 obj 确实存在

[:local_assigns, :output_buffer, :_old_virtual_path, :_old_output_buffer,
:logo, :obj, :_hamlout, :_erbout, :__in_erb_template, :name, :url,  
:path, :haml_temp]

但没有raise它的抱怨:

undefined local variable or method `obj' for #<#<Class:0xadcdb88>:0x9cc9fd0>

Extracted source (around line #1):

1: = link_to popup_information_path(obj.class.short_name, obj), :remote => true do
2:     - image_tag(obj.user.avatar.url)
4

1 回答 1

1

试用- content_for :logo, render(:partial => 'logo', :locals => {:obj => @sites_page})

于 2013-04-26T15:36:47.747 回答