如题
<%= render partial: "a_view", locals: {obj: ***}%>
有的写了 locals,有的没写,我在 a_view 中要怎么判断呢?
if local_assigns[:custom_name] ... 或 if defined?(:custom_name) ...
if local_assigns[:custom_name] ...
if defined?(:custom_name) ...
#1 楼 @fumesy 第一种方法 ok,非常感谢