看法:-
<% @dating_advices.each do |da| %>
<% if da['is-displayed'][0]['content'] == 'true' %>
<div class="dating_advice">
<h4><%= da['title'][0] %></h4>
<p><b><%= da['author'][0] %></b></p>
<p><%= da['content'] %></p>
</div>
<hr>
<% end %>
<% end %>
控制器:-
def dating_advices
@current_menu = "MatchMasters"
logger.debug "*** Current site id: #{@current_site.id}"
#@hide_quick_search = true
@passed_args = {
'event_action' => 'ws',
'site_id' => @current_site.site_id
}
result = call_dating_advices_ws(@passed_args)
if result && result['errorcode'][0] == 'success'
@dating_advices = result['payload'][0]['payload']
end
end
现在,当我单击网页上的约会建议时,它会出现错误“Getting Template::Error (Undefined method 'each') for nil:NIL Class”