user2953607
user2953607

Reputation: 97

Rails url path: obj_new_path versus new_obj_path

I'm creating a messageboard in Rails and have a model called Post and created one called Reply dependent on Post.

Can somebody explain the difference between the automatically created URL paths?

replies_new_path

and

new_post_path

I checked the class and controller names and Rails has done the correct pluralization of Reply. I do not understand the difference in the order. Any clues?

Upvotes: 1

Views: 35

Answers (1)

Niall Paterson
Niall Paterson

Reputation: 3580

It's pretty straight forward - A post has_many replies (I assume), so since the post is singular but there are many replies, rails convention dictates that it's replies_new_path and new_post_path.

Upvotes: 3

Related Questions