mongoid/mongoid — Issue #1410: has_many relationships fail when the owning model name ends with the letter S
Author: AaronH
Created: 2011-11-03 22:26:33+00:00
State: open

This appears to be a cousin of the [issue 1310](https://github.com/mongoid/mongoid/issues/1310) and is related to the ActiveSupport inflector handling of singular and plural model names.

```ruby
class Message
include Mongoid::Document
belongs_to :business
end

class Business
include Mongoid::Document
has_many :messages
end
```

When attempting to access the messages from the business model is where the magic happens.

>> Lead.new.business
=> nil

>> Business.new.leads
NameError: uninitialized constant Busines

>> Business.first.leads
NameError: uninitialized constant Busines

I've tried various combinations of inverse_of (singular and plural both directions) with no success. The only solution found so far is to use has_and_belongs_to_many.