Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActiveAdmin - how to render default template in customized action

We are using ActiveAdmin in our Rails3 application for the default models. Now we needed to overwrite the show action. The OrderProcess model is a transient (tableless) model, which means that all fields are aggregated from other data. We use an internal module that provides the necessary methods to mock the MetaSearch methods ActiveAdmin is depending on. The following is how we overwrite the show action:

ActiveAdmin.register OrderProcess do  
  member_action :show, :method => :get do
    @order_process = OrderProcess.all_orders_for_deal(params['id'])
  end
end

That gives us an error complaining about a missing template "Missing template admin/order_processes/show with ..."

We also tried to call

  render renderer_for(:show)

but that produced an error about a missing method model_name which may be due to our model being tableless and the regarding module.

How can we use ActiveAdmins built in rendering methods to display our model? Any help is appreciated.

like image 730
dhenze Avatar asked Jul 11 '11 16:07

dhenze


1 Answers

Just ran into this... Grant's comment is correct, active_admin_template doesn't exist any more (I'm on 1.0.0-pre2).

I ended up going with:

render :action => :edit, :layout => false

which seems to work, although you will have to supply a label for the header, which displays as "translation missing: en.active_admin.[your_action]_model"

like image 112
Anthony Wang Avatar answered Oct 16 '22 10:10

Anthony Wang