gregbell/active_admin — Issue #1022: There is no easy way to add instance collections
Author: denispeplin
Created: 2012-02-16 07:34:47+00:00
State: open

I need to do something like this

```ruby
ActiveAdmin.register DslPort do
form do |f|
f.inputs do
f.input :snmp_profile, as: :select, collection: @dsl_port.snmp_profiles
end
f.buttons
end
end
```
or

```ruby
f.input :snmp_profile, as: :select, collection: DslPort.find(params[:id]).snmp_profiles

```

In short: call instance method of object, which returns array.

But it is impossible, because inside this block, only "f" and "@config" variables are available. No params[:id] variable, which makes impossible working with instance.

I spent 3 hours parsing documentation, googling, etc. Maybe, I missed something, or it is just documentation issue.

Is it any way to pass instance variable to "form" block? I don't need any customization, just need some variable to know which instance I'm currently editing.