ActiveAdmin呈现部分错误

时间:2014-12-23 10:49:53

标签: ruby-on-rails activeadmin partials

我正在关注此guide以在我的Active Admin面板中创建折线图。但是我收到了一个丢失的模板错误:

ActionView::MissingTemplate in Admin::SellerGrowth#index

Showing /home/vedant/.rvm/gems/ruby-2.1.0/bundler/gems/activeadmin-fc1874f7d3b4/app/views/active_admin/page/index.html.arb where line #2 raised:

Missing partial metrics/_line_chart with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :arb, :jbuilder]}. Searched in:
  * "/home/vedant/rails/Instano-api/app/views"
  * "/home/vedant/.rvm/gems/ruby-2.1.0/bundler/gems/activeadmin-fc1874f7d3b4/app/views"
  * "/home/vedant/.rvm/gems/ruby-2.1.0/gems/kaminari-0.16.1/app/views"
  * "/home/vedant/.rvm/gems/ruby-2.1.0/gems/devise-3.4.0/app/views"
Extracted source (around line #2):
insert_tag active_admin_application.view_factory["page"]

我的admin/metrics/user.rb

ActiveAdmin.register_page "Seller Growth"  do

  content do
    @metric = V1::Seller.group_by_day(:created_at).count
    render :partial => '/metrics/line_chart', :locals => {:metric => @metric}
  end

end

我的app/views/metrics/_line_chart.html.erb

<%= javascript_include_tag "//www.google.com/jsapi", "chartkick" %>
<%= line_chart metric %>

只是为了确保我不会错过输入任何内容: 在运行

find app/views/metrics/

我得到了

app/views/metrics/
app/views/metrics/_line_chart.html.erb

1 个答案:

答案 0 :(得分:0)

试试这个

应用程序/视图/管理/ seller_growth /度量/ _line_chart.html.erb

render:partial =&gt; 'line_chart',:locals =&gt; {:metric =&gt; @metric}