mongoid/mongoid — Issue #1390: Wrong constant name customer
Author: lisinge
Created: 2011-10-31 18:49:20+00:00
State: open

This error appeared somewhere after updating from 2.3.0 to 2.3.3:

ruby-1.9.3-p0 :002 > Customer.first
NameError: wrong constant name customer
from /Users/lisinge/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.1/lib/active_support/inflector/methods.rb:124:in `const_defined?'
from /Users/lisinge/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.1/lib/active_support/inflector/methods.rb:124:in `block in constantize'
from /Users/lisinge/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.1/lib/active_support/inflector/methods.rb:123:in `each'
from /Users/lisinge/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.1/lib/active_support/inflector/methods.rb:123:in `constantize'
from /Users/lisinge/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.1/lib/active_support/core_ext/string/inflections.rb:43:in `constantize'
from /Users/lisinge/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.3.3/lib/mongoid/factory.rb:39:in `from_db'
from /Users/lisinge/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.3.3/lib/mongoid/contexts/mongo.rb:162:in `first'
from /Users/lisinge/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.3.3/lib/mongoid/criteria.rb:43:in `one'
from /Users/lisinge/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.3.3/lib/mongoid/criterion/inclusion.rb:127:in `find'
from /Users/lisinge/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.3.3/lib/mongoid/finders.rb:84:in `find'
from /Users/lisinge/.rvm/gems/ruby-1.9.3-p0/gems/mongoid-2.3.3/lib/mongoid/finders.rb:122:in `first'
from (irb):2
from /Users/lisinge/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.1/lib/rails/commands/console.rb:45:in `start'
from /Users/lisinge/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.1/lib/rails/commands/console.rb:8:in `start'
from /Users/lisinge/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.1/lib/rails/commands.rb:40:in `'
from script/rails:6:in `require'
from script/rails:6:in `

'ruby-1.9.3-p0 :003 >

All the other models works just fine for some reason. The customer model looks like this:

class Customer
include Mongoid::Document
include Mongoid::Timestamps

field :name, type: String

end