views:

51

answers:

1

I'm trying to teach myself rails by going through http://railstutorial.org/. I quit working on the tutorial app last night and then came back to it today. Now I'm getting an error when I start up the Spork server. Here is a trace of the error.

spork Using RSpec Loading Spork.prefork block... can't convert nil into Hash (TypeError) /usr/local/lib/ruby/gems/1.8/gems/activemodel-3.0.0/lib/active_model/validations/validates.rb:90:in merge' /usr/local/lib/ruby/gems/1.8/gems/activemodel-3.0.0/lib/active_model/validations/validates.rb:90:invalidates' /usr/local/lib/ruby/gems/1.8/gems/activemodel-3.0.0/lib/active_model/validations/validates.rb:83:in each' /usr/local/lib/ruby/gems/1.8/gems/activemodel-3.0.0/lib/active_model/validations/validates.rb:83:invalidates' /Users/chietala/Desktop/rails_projects/sample_app/app/models/user.rb:20 /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:454:in load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:454:inload_file' /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in new_constants_in' /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:453:inload_file' /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:340:in require_or_load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:300:independ_on' /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:216:in require_dependency' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/engine.rb:138:ineager_load!' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/engine.rb:137:in each' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/engine.rb:137:ineager_load!' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/engine.rb:135:in each' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/engine.rb:135:ineager_load!' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/application.rb:108:in eager_load!' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/application/finisher.rb:41 /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:25:ininstance_exec' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:25:in run' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:50:inrun_initializers' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:49:in each' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:49:inrun_initializers' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/application.rb:134:in initialize!' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/application.rb:77:insend' /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/application.rb:77:in method_missing' /Users/chietala/Desktop/rails_projects/sample_app/spec/../config/environment.rb:5 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require' /Users/chietala/Desktop/rails_projects/sample_app/spec/spec_helper.rb:10 /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/bin/../lib/spork.rb:23:inprefork' /Users/chietala/Desktop/rails_projects/sample_app/spec/spec_helper.rb:4 /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/lib/spork/test_framework.rb:138:in load' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/lib/spork/test_framework.rb:138:inpreload' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/lib/spork/app_framework.rb:64:in preload' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/lib/spork/test_framework.rb:134:inpreload' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/bin/../lib/spork.rb:67:in exec_prefork' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/lib/spork/test_framework.rb:120:inpreload' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/lib/spork/run_strategy/forking.rb:25:in preload' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/bin/../lib/spork/runner.rb:74:inrun' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/bin/../lib/spork/runner.rb:9:in run' /usr/local/lib/ruby/gems/1.8/gems/spork-0.8.4/bin/spork:10 /usr/local/bin/spork:19:inload' /usr/local/bin/spork:19

Luckily I am using Git for version control and I was in a separate branch when I received this problem, however switching to the master still results in the error.

I'm not really sure where or how to fix this problem. Anyone have any ideas?

A: 

I was using 1.9.2, rails3, and rspec-rails 2.0.0rc with spork-0.8.4 successfully. Then I upgraded to rspec-rails 2.0.0 and had some issues.

I just upgraded my Gemfile to rspec-rails 2.0.1 and spork 0.9.0.rc2 and everything works again!

Gemfile:

gem 'rspec-rails','>= 2.0.1'
gem 'spork', '>= 0.9.0.rc2'

Give that a shot. (You can always switch back to your old version, if it doesn't help.)

Check the spork page on github to see if there are any other things to consider. If you are using 1.8.7 there may be some differences.

If you want the cutting edge (sometimes I do on gems):

gem 'spork', :git => 'http://github.com/timcharper/spork.git'

Maybe there is a fix for your particular combo....

Let me know if this helps!

nearapogee