hypee
hypee

Reputation: 718

Singular or plural scope names in Rails

I have a question in my head.

Is there any disadvantage to using singular or plurial in names for scope ? I found nothing on the question. Sometimes I put in the plural to help me understand the real scope without following convention.

There's a convetion?

Upvotes: 4

Views: 2526

Answers (1)

Philip Hallstrom
Philip Hallstrom

Reputation: 19899

I'm not aware of one. I use whatever "reads well." If the scope is filtering there results, then plural seems to read the best -- User.admin vs User.admins. But not all the time. Event.on_date(Time.now) wouldn't make sense as a plural. But then again I'd really rather that was Events.on_date... but I can't do that either.

So for me... whatever reads the best while writing the code is probably the right way to go.

Upvotes: 3

Related Questions