sferik/rails_admin — Issue #966: Rails 3.2.1 generator error
Author: veverkap
Created: 2012-02-07 02:56:39+00:00
State: open

I'm trying to install into an app with existing models. I get this error:

```bash
new-host-3:oscarrails patrickveverka$ rails g rails_admin:install
- Hello, RailsAdmin installer will help you sets things up!
- I need to work with Devise, let's look at a few things first:
- Checking for a current installation of devise...
- Found it!
- Looks like you've already installed it, good!
- And you already set it up, good! We just need to know about your user model name...
- We found 'user' (should be one of 'user', 'admin', etc.)
? Correct Devise model name if needed. Press for [user] >
- Ok, Devise looks already set up with user model name 'user':
- Now you'll need an initializer...
create config/initializers/rails_admin.rb
/Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/activerecord-3.2.1/lib/active_record/reflection.rb:385:in `block in source_reflection': undefined method `klass' for nil:NilClass (NoMethodError)
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/activerecord-3.2.1/lib/active_record/reflection.rb:385:in `collect'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/activerecord-3.2.1/lib/active_record/reflection.rb:385:in `source_reflection'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/activerecord-3.2.1/lib/active_record/reflection.rb:375:in `rescue in foreign_key'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/activerecord-3.2.1/lib/active_record/reflection.rb:373:in `foreign_key'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/bundler/gems/rails_admin-8048e7d844c2/lib/rails_admin/adapters/active_record.rb:340:in `association_child_key_lookup'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/bundler/gems/rails_admin-8048e7d844c2/lib/rails_admin/adapters/active_record.rb:104:in `block in associations'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/bundler/gems/rails_admin-8048e7d844c2/lib/rails_admin/adapters/active_record.rb:96:in `map'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/bundler/gems/rails_admin-8048e7d844c2/lib/rails_admin/adapters/active_record.rb:96:in `associations'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/bundler/gems/rails_admin-8048e7d844c2/lib/rails_admin/config/fields/factories/belongs_to_association.rb:6:in `block in '
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/bundler/gems/rails_admin-8048e7d844c2/lib/rails_admin/config/fields.rb:55:in `call'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/bundler/gems/rails_admin-8048e7d844c2/lib/rails_admin/config/fields.rb:55:in `block (2 levels) in factory'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/bundler/gems/rails_admin-8048e7d844c2/lib/rails_admin/config/fields.rb:55:in `each'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/bundler/gems/rails_admin-8048e7d844c2/lib/rails_admin/config/fields.rb:55:in `find'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/bundler/gems/rails_admin-8048e7d844c2/lib/rails_admin/config/fields.rb:55:in `block in factory'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/bundler/gems/rails_admin-8048e7d844c2/lib/rails_admin/config/fields.rb:51:in `each'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/bundler/gems/rails_admin-8048e7d844c2/lib/rails_admin/config/fields.rb:51:in `factory'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/bundler/gems/rails_admin-8048e7d844c2/lib/rails_admin/config/has_fields.rb:129:in `_fields'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/bundler/gems/rails_admin-8048e7d844c2/lib/rails_admin/config/has_fields.rb:127:in `_fields'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/bundler/gems/rails_admin-8048e7d844c2/lib/rails_admin/config/has_fields.rb:107:in `all_fields'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/bundler/gems/rails_admin-8048e7d844c2/lib/rails_admin/config/has_fields.rb:82:in `fields'
from (erb):85:in `block in template'
from (erb):82:in `map'
from (erb):82:in `template'
from /Users/patrickveverka/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/erb.rb:753:in `eval'
from /Users/patrickveverka/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/erb.rb:753:in `result'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/actions/file_manipulation.rb:111:in `block in template'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/actions/create_file.rb:54:in `call'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/actions/create_file.rb:54:in `render'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/actions/create_file.rb:63:in `block (2 levels) in invoke!'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/actions/create_file.rb:63:in `open'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/actions/create_file.rb:63:in `block in invoke!'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:114:in `call'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:114:in `invoke_with_conflict_check'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/actions/create_file.rb:61:in `invoke!'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/actions.rb:95:in `action'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/actions/create_file.rb:26:in `create_file'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/actions/file_manipulation.rb:110:in `template'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/bundler/gems/rails_admin-8048e7d844c2/lib/generators/rails_admin/install_generator.rb:59:in `install'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/railties-3.2.1/lib/rails/generators.rb:170:in `invoke'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/railties-3.2.1/lib/rails/commands/generate.rb:12:in `'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
from /Users/patrickveverka/.rvm/gems/ruby-1.9.2-p290@rails32/gems/railties-3.2.1/lib/rails/commands.rb:29:in `'
from script/rails:6:in `require'
from script/rails:6:in `

'
new-host-3:oscarrails patrickveverka$
```