sferik/rails_admin — Issue #990: Undefined method when configuring models that use paperclip
Author: fernandomm
Created: 2012-02-20 01:54:54+00:00
State: open

I have a model with a image field, managed by paper clip gem:

```
class Singer < ActiveRecord::Base
attr_accessible :name, :image

has_attached_file :image, :styles => { :thumb => "300x300>" }
end
```

If i try to change the configuration of this model in rails_admin initializer, like this:

```
config.model Singer do
list do
field :image do
hide
end
end
end
```

I get the following error:

```
/Users/fernando/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.0/lib/active_record/dynamic_matchers.rb:50:in `method_missing': undefined method `has_attached_file' for # (NoMethodError)
```

It looks like when rails_admin load this model, paperclip is not loaded yet.

Are there any workarounds for this problem?