0
votes

I have got this error message when using rails3 consol

irb(main):018:0> WebtrisulMenu.find(1)
NoMethodError: undefined method eq' for nil:NilClass
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/whiny_nil.rb:48:in
method_missing'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/relation/finder_methods.rb:299:in find_one'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/relation/finder_methods.rb:289:in
find_with_ids'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/relation/finder_methods.rb:107:in find'
from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/base.rb:444:in
find'
from (irb):18
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/commands/console.rb:44:in start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/commands/console.rb:8:in
start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/commands.rb:23:in <top (required)>'
from script/rails:6:in
require'
from script/rails:6:in `'

But using like this ,its working fine

irb(main):019:0> WebtrisulContext.find(:all,:conditions=>['id =1'])
=> WebtrisulContext id: 1, name: "Primary", internal_name: "", description: "The default Web Trisul context", slinkname: "root_ctx0", webtrisul_dashboard_id: nil

please help me to get out of this?

1
can you post your Gemfile and WebtrisulMenu model source code?Anatoly

1 Answers

0
votes

There is something wrong with your WebtrisulMenu class. It's not getting initialized when Rails environment is loaded as the nilclass error tells me.

Therefore, You are unable to do find on the WebtrisulMenu model.

See for anything wrong in this model, and if you can't figure it out yourself, post the contents of the file here.