gregbell/active_admin — Issue #957: nested attribute crashing
Author: jshow
Created: 2012-01-31 20:41:29+00:00
State: open

Greetings,

the following config (activeadmin 4, rails 3.2) crashes when rendering the Edit view.

If I remove accepts_nested_attributes_for, the form will render. In fact I can use a bogus association name in the "inputs", and it will render.

I'd appreciate any thoughts. Perhaps this is a formtastic issue ? (will active_admin use a more recent version of formtastic if installed? installed versions are 2.0.2, 1.2.4.

Backtrace:
/Users/jodi/.rvm/gems/ruby-1.9.2-p290@homestars/gems/activesupport-3.1.1/lib/active_support/whiny_nil.rb:48:in `method_missing'
/Users/jodi/.rvm/gems/ruby-1.9.2-p290@homestars/gems/activeadmin-0.4.0/lib/active_admin/form_builder.rb:15:in `inputs'
/Users/jodi/dev/homestars/rails_3/crm/app/admin/member_promotions.rb:139:in `block (2 levels) in '

```ruby
member_promotions.rb

ActiveAdmin.register MemberPromotion do

form(:html => { :multipart => true }) do |f|
f.inputs "Beneficiary Logo", :for => :beneficiary_logo do |logo_form| # line 139
logo_form.input :photo, :label => 'Prize Company Logo', :as => :file
end
end
```

```ruby
member_promotion.rb
class MemberPromotion < ActiveRecord::Base
attr_accessible :beneficiary_logo_attributes

belongs_to :beneficiary_logo, :class_name => 'Image', :foreign_key => 'beneficiary_logo_id'

accepts_nested_attributes_for :beneficiary_logo
```