I'm creating models that are specific to another model (which will ultimately be embedded in the parent model using Mongoid). Now I'm just stuck with trying to figure out how to name them. I've seen it done both ways, so I don't know what to do:
Singular:
models/
post.rb
post/
comment.rb
comment/
happy_comment.rb
class Post
class Post::Comment
class Post::Comment::HappyComment < Post::Comment
Plural:
models/
post.rb
posts/
comment.rb
comments/
happy_comment.rb
class Post
class Posts::Comment
class Posts::Comments::HappyComment < Posts::Comment
The benefit to the later is that there can be Posts
and Comments
modules for wrapping around each child model:
module Posts
module Comments
class HappyComment < Comment
What is the correct way to namespace these child models?