Rails:#<ActionView::Base:0x007f8091a1cb88>

问题描述 投票:0回答:0

我有一个叫

FeaturesHelper
的帮手,它有一些功能的数据:

feature_info = [
    {features:
        [
            {
                description: "This is a #{view_context.link_to "link!", "https://www.example.com", target: :_blank, class: "pink-link"}", 
            }
        ]
}, ...]

然后我有一个部分使用

feature_info

<% feature_info.each do |info|%>    
    <% info[:features].each do |feature| %>
        <%= feature[:description].html_safe %>                               
    <% end %>
<% end %>    
  

然后我在视图中渲染部分:

<%= render partial: "partial_name" %>

这导致错误,堆栈跟踪指向 no my

FeaturesHelper

#ActionView::Base:0x007f80a6cdcf20 的未定义局部变量或方法“view_context”

ruby-on-rails actionview
© www.soinside.com 2019 - 2024. All rights reserved.