Save 36% for Black Friday! Learn more

New Discussion

Notifications

You’re not receiving notifications from this thread.

Controller naming...

3
Rails

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

Join the discussion
Create an account Log in