开发者

Rails rake test returns an error message

I am a rails newbie and receive the following message when I run rake test. This is a an application based on rails community engine.

I tried creating a test application just to make sure that my gems etc. are fine and I am able to run rake test successfully in that application.

It would be great if someone could shed a light on what is going wrong...

  /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/whiny_nil.rb:52:in `method_missing': undefined method `merge' for nil:NilClass (NoMethodError)
  from /home/eakkas/NetBeansProjects/hello_ce/vendor/plugins/community_engine/app/controllers/users_controller.rb:17
  from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
  from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
  from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require_without_desert'
  from /usr/lib/ruby/gems/1.8/gems/desert-0.5.3/lib/desert/ruby/object.rb:8:in `require'
  from /usr/lib/ruby/gems/1.8/gems/desert-0.5.3/lib/desert/ruby/object.rb:32:in `__each_matching_file'
  from /usr/lib/ruby/gems/1.8/gems/desert-0.5.3/lib/desert/ruby/object.rb:7:in `require'
  from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:265:in `require_or_load'
  from /usr/lib/ruby/gems/1.8/gems/desert-0.5.3/lib/desert/rails/dependencies.rb:27:in `depend_on'
  from /usr/lib/ruby/gems/1.8/gems/desert-0.5.3/lib/desert/rails/dependencies.rb:26:in `each'
  from /usr/lib/ruby/gems/1.8/gems/desert-0.5.3/lib/desert/rails/dependencies.rb:26:in `depend_on'
  from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:136:in `require_dependency'
  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:414:in `load_application_classes'
  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:413:in `each'
  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:413开发者_开发知识库:in `load_application_classes'
  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:411:in `each'
  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:411:in `load_application_classes'
  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:197:in `process'
  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'


The error is never enough information to go off of alone. however, so simple things, did you run sudo rake gems:install already?

also i am seeing this line below

app/controllers/users_controller.rb line 17

we'd need to see your controller as well it looks like.

also what happens if you just use rake?


I know this has been open for a while....

I have do know that CE is not currently compatible with Rails 2.3.5 (greatest support Rails version is 2.3.4). Maybe that is the problem?


It looks like you're trying to call "merge" on a nil.

You must include the line from your users_controller to let us know what the code is doing at that point. It may be that you've got something like:

params[:widget].merge(some_hash)

and that you're calling this even when params[:widget] is empty (ie no params have been sent). If this is the case, then you just need to do this:

(params[:widget] || {}).merge(some_hash)


On line 17 of your users controller you will have something like @some_variable.do_something

The thing is that @some_variable is an instance (object) of the class called Nil which doesn't have a .do_something method.

That line of code will be expecting an instance of the User class most likely and as it looks like you are using the community engine plugin I'd say that it's most likely you are letting something get through to the users controller without a valid user.

Have a look at the controller to see what it's expecting then make sure that you do whatever is necessary to give it what it needs. With the information you have provided it is unfortunately not possible to give you any more of a clue as to what it is you need to do to solve the problem

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜