Open felipefontoura opened 9 years ago
It's amazing @felipefontoura :dancer: But for this example, we can't do anything using or no named parameters the call of method will be:
Installment.overdue
I thought it's a good ideia, standardize method names using named params, when it uses more than one param!
Yes @brunoocasali!
Named params need to be used with caution, but it really helps! Ruby On Rails use it every time like a boss!
In this case, I prefer:
Installment.overdues_for somedate
or:
Installment.overdues from: datetime
Wherever, but I have been used first option... :v:
Hey guys! Can I close or implement it?
I wish we could implement the follow guideline:
When you need to use more than one parameter, please add named parameter pattern like:
Installment.overdues from: datetime
But, when you need to use just one parameter:
Installment.overdues somedate
Hello Folks,
In our internal projects I see default value for the method's parameters used frequently, and I think that it can be a toxic for a best understanding, because normally it's means Business Rules but hidden.
For example:
And we can call it using:
Ok, it's will run gracefully...
But the next Developer need to read the model's code to understand that
overdue
need to receive a date parameter, and if this date isn't .In our method's guide (https://github.com/internetsistemas/guides/tree/master/style-guides/ruby#methods) we encourage devs to use named parameters for best understanding.
What do you think?