neo
neo

Reputation: 4116

Active admin not finding partial in show

This should be pretty simple, trying to render a partial on active admin in show action:

Object name is: Listing

ActiveAdmin.register Listing do
  show do
    attributes_table do
      row :foo
      row :bar
      render 'map'
     end
   end 
end

I added the partial under app/admin/listings/_map.html.haml

I get the no template found error:

Missing partial admin/listings/_map, active_admin/resource/_map, active_admin/base/_map, inherited_resources/base/_map, application/_map with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :arb, :haml, :jbuilder]}.

Also tried adding here: app/admin/_map.html.haml and admin/listings/_map.html.haml

And tried: moving the render outside the attributes_table, like so:

  show do          
    render 'map'
    attributes_table do
      row :foo
      row :bar
      ...

On rails', '4.1.9', 'activeadmin', '~> 1.0.0.pre1'

Upvotes: 1

Views: 1632

Answers (1)

Andrey Deineko
Andrey Deineko

Reputation: 52377

Your view should be put into views directory:

app/views/admin/listings/_map.html.haml

Rendering partial should look as follows:

show do
  render partial: 'map'
  # ...
end

Upvotes: 2

Related Questions