我有这个控制器:
def index
@disclosures = Disclosure.where(:user_id => current_user.id)
respond_to do |format|
format.html{}
format.js{}
end
end
在 StackOverflow 的好人的帮助下,我现在可以让我的 HAML 指向这样的部分:
= render :partial => "/influencers/disclosures/shared/list"
但这部分抛出和异常:
-if disclosures.empty?
.alert.alert-info
%p=(no_disclosures_message || (t "influencers.influencer_dashboard.disclosures.no_disclosures"))
%table.table.influencer-disclosures
%tbody
-disclosures.each do |disclosure|
=render "influencers/disclosures/shared/row", :disclosure => disclosure
说:
undefined local variable or method `disclosures' for #<#<Class:0x133ca8a58>:0x133ca25e0>
但这怎么可能呢?我刚刚在我的控制器中查询了该披露对象。知道为什么会发生这种情况以及如何解决吗?
谢谢!!