Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

missing partial when putting a model in another model

I have never seen an error like this, so I don't even know what information of my app to share with you. I am putting an 'address' model inside a 'customer model'. Here is the error. (edit)I am using SprintApp as a guide for my app. They too also have a addess model, and their clients model is my customers model.

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

I know its hard to ask for an answer without showing my code, but we can atleast start the dialogue and i can edit and add whats needed. Thanks in advance.

customers controller

    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

Customers _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 
%>

Addresses _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 
%>
like image 512
DhatchXIX Avatar asked Jun 07 '26 05:06

DhatchXIX


1 Answers

Check the same error as indicated by Kwent and the solutions as follows:

Also see the following error:

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]}.

The error also indicates that you are missing a partial as listed in the error log.

For example:

The partial file _form.html.erb should be in app/views/admin/customers folder. Same is for others.

Then you should render your partial like: <%= render :partial => "form" %> in your controller.

Hope this will help you!

like image 164
My God Avatar answered Jun 09 '26 01:06

My God