Skip to main content
Ask A Question
Notifications
You’re not receiving notifications from this thread.
Subscribe

Controller naming...

Rails • Asked by Alan Reid

Evening all,
So i have a question about naming controllers. Which would be best to use? MyOrder or MyOrders

Is it just the DB which get pluralised?


It's convention to use the plural form for your controllers.

Example:
OrdersController -> app/controllers/orders_controller.rb, a model would be Order

If you think about it, when you define a route you most likely use resources :orders in that circumstance. Then Rails knows it's looking for an orders controller.

I hope that helps?


Cheers Andrew,
Orders makes much more sense :D thanks


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 30,005+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.