I know Rails has a pretty solid convention for having plural controller names ex: CustomersController. It seems like Elixir wouldn't care because the routing is done differently. Is there an idiomatic way to name controllers in Phoenix?
To avoid some of the confusion that exists in Rails caused by where to use singular vs plural, Phoenix decided to go with singular form consistently. This change was made back in Phoenix v0.4.0. Here's the explanation as to why:
Phoenix also does not impose singular and plural naming rules. Rails naming rules can confuse beginners and advanced developers alike: models use singular names, controllers use plural ones, URL helpers mix both, and so on. Phoenix consistently uses singular rules, as any other Elixir code. You may use plural names for your tables and router paths, but those are explicitly written at your system boundaries.
I bolded the most important part for your convenience. If you'd like to see some of the discussion around where these decisions were made, check out this issue on the Phoenix repo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With