Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-1509

Simple find leads to: "undefined method `first' for true:TrueClass"

    • Type: Icon: Task Task
    • Resolution: Done
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      Ruby 1.9.2-head, Mongoid 2.4

      really bizarre...

      Loading development environment (Rails 3.1.1)
      ruby-1.9.2-head :001 > Post.find(BSON::ObjectId('4ee2422d13493b0001000352'))
      NoMethodError: undefined method `first' for true:TrueClass
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/relations/builders/embedded/many.rb:24:in `build'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/relations/accessors.rb:43:in `create_relation'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/relations/accessors.rb:26:in `build'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/relations/accessors.rb:101:in `block (4 levels) in getter'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/threaded/lifecycle.rb:125:in `_loading'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/relations/accessors.rb:100:in `block (3 levels) in getter'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/threaded/lifecycle.rb:84:in `_building'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/relations/accessors.rb:99:in `block (2 levels) in getter'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/callbacks.rb:88:in `block (2 levels) in cascadable_children'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/callbacks.rb:84:in `each_pair'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/callbacks.rb:84:in `block in cascadable_children'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/callbacks.rb:83:in `tap'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/callbacks.rb:83:in `cascadable_children'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/callbacks.rb:42:in `run_callbacks'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/document.rb:291:in `block in instantiate'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/document.rb:287:in `tap'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/document.rb:287:in `instantiate'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/factory.rb:40:in `from_db'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/contexts/mongo.rb:162:in `first'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/criteria.rb:45:in `first'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/criterion/inclusion.rb:169:in `from_map_or_db'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/criterion/inclusion.rb:149:in `execute_or_raise'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/criterion/inclusion.rb:129:in `find'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/bundler/gems/mongoid-f2dada1ece84/lib/mongoid/finders.rb:84:in `find'
      	from (irb):1
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.1/lib/rails/commands/console.rb:45:in `start'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.1/lib/rails/commands/console.rb:8:in `start'
      	from /Users/nader/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.1/lib/rails/commands.rb:40:in `<top (required)>'
      	from script/rails:6:in `require'
      	from script/rails:6:in `<main>'
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            nader Nader Akhnoukh
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: