Hi!

Another problem...

I am using a model named "Factory" since the beginning of this
project. Now I wanted to migrate my tests that depends on a manually
seeded database over to factory_girl.

In production I can still enter console or start the server, but when
trying to do anything in test-env, then I get the following
stacktrace:

/home/nmelzer/Dokumente/sources/ruby/1.9.2/rails3.1/webworld/app/models/factory.rb:1:in
`<top (required)>': Factory is not a class (TypeError)
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in
`require'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in
`block in require'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:225:in
`load_dependency'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in
`require'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:348:in
`require_or_load'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:302:in
`depend_on'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:214:in
`require_dependency'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/railties-3.1.0/lib/rails/engine.rb:416:in
`block (2 levels) in eager_load!'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/railties-3.1.0/lib/rails/engine.rb:415:in
`each'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/railties-3.1.0/lib/rails/engine.rb:415:in
`block in eager_load!'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/railties-3.1.0/lib/rails/engine.rb:413:in
`each'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/railties-3.1.0/lib/rails/engine.rb:413:in
`eager_load!'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/railties-3.1.0/lib/rails/application/finisher.rb:51:in
`block in <module:Finisher>'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/railties-3.1.0/lib/rails/initializable.rb:25:in
`instance_exec'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/railties-3.1.0/lib/rails/initializable.rb:25:in
`run'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/railties-3.1.0/lib/rails/initializable.rb:50:in
`block in run_initializers'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/railties-3.1.0/lib/rails/initializable.rb:49:in
`each'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/railties-3.1.0/lib/rails/initializable.rb:49:in
`run_initializers'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/railties-3.1.0/lib/rails/application.rb:92:in
`initialize!'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in
`method_missing'
        from 
/home/nmelzer/Dokumente/sources/ruby/1.9.2/rails3.1/webworld/config/environment.rb:5:in
`<top (required)>'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/railties-3.1.0/lib/rails/application.rb:78:in
`require'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/railties-3.1.0/lib/rails/application.rb:78:in
`require_environment!'
        from 
/home/nmelzer/.rvm/gems/ruby-1.9.2-p180@webworld/gems/railties-3.1.0/lib/rails/commands.rb:39:in
`<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

This looks plausible to me. Since factory_girl provides a module Factory.

But how can I avoid this problem, without completely rewriting all
code that depends on my model?

Or alternatively, are there any similar things like Factory_girl that
will not have that collision with my own code?

TIA
Norbert

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to