我从未见过这样的错误,所以我甚至不知道我的应用程序的哪些信息要与您分享。我将“地址”模型放在“客户模型”中。这是错误。 (编辑)我使用SprintApp作为我的应用的指南。他们也有一个addess模型,他们的客户模型是我的客户模型。
ActionView::MissingTemplate in Admin/customers#new
Showing /usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/active_admin-fa7e4de2d5fa/app/views/active_admin/resource/new.html.arb where line #1 raised:
Missing partial admin/customers/form, active_admin/resource/form, active_admin/base/form, inherited_resources/base/form, application/form with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :arb, :coffee, :haml]}. Searched in:
* "/Users/danielhatcher/rails/print/app/views"
* "/usr/local/rvm/gems/ruby-1.9.3-p392/bundler/gems/active_admin-fa7e4de2d5fa/app/views"
* "/usr/local/rvm/gems/ruby-1.9.3-p392/gems/kaminari-0.14.1/app/views"
* "/usr/local/rvm/gems/ruby-1.9.3-p392/gems/devise-2.2.3/app/views"
Extracted source (around line #1):
1: insert_tag renderer_for(:new)
Rails.root: /Users/danielhatcher/rails/print
Application Trace | Framework Trace | Full Trace
我知道很难在不显示我的代码的情况下寻求答案,但我们至少可以启动对话,我可以编辑并添加所需的内容。提前谢谢。
客户控制器
ActiveAdmin.register Customer do
# Menu item
menu :label => "Customers", :parent => "Administration"
index do
column :name
end
form :partial => "form"
show :title => :name do
panel "Client Details" do
attributes_table_for resource do
row :name
row :email
row :phone
row :created_at do
resource.created_at.humanize
end
row :updated_at do
resource.updated_at.humanize
end
end
text_node(render :partial => "addresses/show", :locals => { :address => resource.address })
end
end
end
客户_form
<%=
semantic_form_for @customer, :builder => ActiveAdmin::FormBuilder do |f|
f.inputs "Customer Information" do
f.input :name
f.input :email
f.input :phone
render :partial => "addresses/form", :locals => { :form => f }
f.buttons
end
%>
地址_form
<%=
form.inputs "Address" do
form.semantic_fields_for :address do |address|
address.inputs :class => "" do
address.input :street
address.input :city
address.input :state, :as => :select, :collection => States::all.invert
address.input :zip, as: :string
end
end
end
%>
答案 0 :(得分:1)
按照Kwent
和解决方案的说明检查same error,如下所示:
另见以下错误:
缺少部分管理员/客户/表单,active_admin / resource / form, active_admin / base / form,inherited_resources / base / form, 申请/表格{:locale =&gt; [:en],:formats =&gt; [:html], :handlers =&gt; [:erb,:builder,:arb,:coffee,:haml]}。
该错误还表示您缺少错误日志中列出的部分。
例如:
部分文件_form.html.erb
应位于app/views/admin/customers
文件夹中。
其他人也一样。
然后你应该在控制器中渲染你的部分:<%= render :partial => "form" %>
。
希望这会对你有帮助!
答案 1 :(得分:0)
当你说你在“客户”模型中放置一个“地址”模型时,我假设你的意思是表单,我假设这意味着你在同一个视图中放置了两个表单?
无论哪种方式,我们都需要您尝试显示的视图以及调用控制器。我最初的猜测是你是名字空间 - 比如Admin::CustomersController
,但你还没有运行生成器来从active_admin
生成视图。
从未使用active_admin,但根据文档,您是否尝试过运行以下内容?
rails generate active_admin:assets