sferik/rails_admin — Issue #1018: Can't configure Model when using Sunspot
Author: brutuscat
Created: 2012-02-28 23:21:08+00:00
State: open

When enabling and changing per Model configuration in the ```rails_admin.rb```, after restarting Rails I got the following exception when the enabled Model implements Sunspot searchable method:

```
~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activerecord-3.2.1/lib/active_record/dynamic_matchers.rb:50:in `method_missing': undefined method `searchable' for # (NoMethodError)
from ~/entretenerse2/app/models/event.rb:36:in `'
from ~/entretenerse2/app/models/event.rb:1:in `'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:469:in `load'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:469:in `block in load_file'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:639:in `new_constants_in'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:468:in `load_file'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:353:in `require_or_load'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:502:in `load_missing_constant'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:192:in `block in const_missing'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:190:in `each'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:190:in `const_missing'
from ~/entretenerse2/config/initializers/rails_admin.rb:123:in `block in '
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/bundler/gems/rails_admin-93f3fcbd6a13/lib/rails_admin.rb:29:in `call'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/bundler/gems/rails_admin-93f3fcbd6a13/lib/rails_admin.rb:29:in `config'
from ~/entretenerse2/config/initializers/rails_admin.rb:4:in `'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in `load'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in `block in load'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_dependency'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in `load'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/railties-3.2.1/lib/rails/engine.rb:588:in `block (2 levels) in '
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/railties-3.2.1/lib/rails/engine.rb:587:in `each'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/railties-3.2.1/lib/rails/engine.rb:587:in `block in '
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `instance_exec'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `run'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/railties-3.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `each'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `run_initializers'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/railties-3.2.1/lib/rails/application.rb:136:in `initialize!'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
from ~/entretenerse2/config/environment.rb:8:in `'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `block in require'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_dependency'
from ~/.rvm/gems/ruby-1.9.3-p0@entretenerse2/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
from ~/entretenerse2/config.ru:4:in `block in

'
```

Using Rails 3.2.1 and Sunspot and Rails Admin from its corresponding masters

I'm think it should be related with some loading order. I tried to "play" with the new ```config.railties_order``` option, but it seems to cause no effect at all..

I tried this ```config.railties_order = [RailsAdmin::Engine, :main_app]``` and this ```config.railties_order = [, :main_app, RailsAdmin::Engine]```