In the blog screencast the commentator creates two model classes,
‘Post’ and ‘Comment’. Note that both of these model classes are
singular. However, when he creates the association he says in the
Post model ‘has_many(:comments)’. IOW, he uses the plural form of the
Comment model and lowers the case of the the model class name.
However, when he does the association within the Comment class he says
‘belongs_to(:post)’. Here he does not pluralize post although he does
(as expected) lower the case. This perplexes me.
Now, I want to follow this example; but, I want my model classes to be
named ‘BlogPost’ and ‘BlogComment’ respectively in order to avoid
potential namespace conflicts. I am not getting my associations to
work. I think that I may be having trouble with the naming. In the
BlogPost class do I say, ‘has_many(:blogComments)’ and in the
BlogComment class say, ‘belongs_to(:blogPost)’? This pluralizing
thing is really confusing me. Additionally, I’m beginning to wonder
if I don’t need to introduce some underscores, e.g., ‘blog_comment’ or
‘blog_comments’. Anyway, I’m obviously very confused. Can someome
please straighten me out on exactly how these associations should be
formed?
Thanks for any input.
... doug