How does mongoid know to use plural name of a model when using references? -
i reading mongoid link, , came this:
class person include mongoid::document has_many :posts end class post include mongoid::document field :title, type: string belongs_to :person end
how mongoid know has_many :posts
refers post
class? same if has_many :post
?
as shows in current mongoid documentation, mongoid uses activesupport::inflector
translate between singular , plural model , table names.
Comments
Post a Comment