gregbell/active_admin — Issue #903: how to tell if current model is AR or MongoDB model in 'add_default_sidebar_sections' method
Author: zben
Created: 2012-01-11 23:57:18+00:00
State: open

I am aware that currently active_admin does not support MongoId yet. I am also aware there are some [patch files](https://gist.github.com/1377082) that one can apply to make it work for mongoid with certain features(filtering) disabled. I am trying to modify this patch so that the admin interface will hide the side bar and disable search for mongoid models but shows them for AR models. However, I am not able to access what model is currently rendered in a method named "add_default_sidebar_sections" . I have tried this but it does not work. I figure either I am calling params too early or it is not exposed to this class ever at all.

```ruby

class Resource
def resource_table_name

resource.respond_to?('table_name') ? resource.table_name : resource.collection_name
end

# Disable filters
def add_default_sidebar_sections
if eval(params['controller'].split("/").last.camelcase).respond_to?('desc')==false
self.sidebar_sections << ActiveAdmin::SidebarSection.new(:filters, :only => :index) do
active_admin_filters_form_for assigns["search"], filters_config
end
end
end
end
```
anyone has any ideas?