I have a model to keep track of points a student earns. Sometimes they earn 1 point and for some tasks they earn multiple points. The table would look something like this:
points
--------------
student_id:integer
task_id:integer
points:integer
earned_at:date
What should I call this model? Point
or Points
? Typically my models are singular and Rails intelligently pluralizes it in the appropriate places. But in this case each record represents a number of points. When I call student.points
I want it to return all the points they've ever earned. When I call student.points.first
I want it to return the first group of points they earned.
Using Rails 3.2.8
I'd keep the model singular; think each Point item as a "point record" or "point group" which contains multiple points. Also, I'd change the 'points' attribute to 'amount' or something, as Point.amount seems cleaner than Point.points.
Check out: https://stackoverflow.com/a/3399753/1700540 and I'm sure you can find other resources with similar opinions.