With a has_many relation, the belongs_to side can specify :counter_cache => true to automatically increment and decrement a count column in the parent model.
Shift signups are currently represented with has_and_belongs_to_many between slot and involvement, with a pure join table. Rendering a signup page with a count of people signed up for each slot thus requires count(*) queries for potentially a couple hundred slots, slowing down shift signup.
Consider creating a join model for this, perhaps named signup, which belongs_to slot, :counter_cache -> true. This could grow a useful field or two, perhaps to mark no-show reason or something.
With a has_many relation, the belongs_to side can specify :counter_cache => true to automatically increment and decrement a count column in the parent model.
Shift signups are currently represented with has_and_belongs_to_many between slot and involvement, with a pure join table. Rendering a signup page with a count of people signed up for each slot thus requires count(*) queries for potentially a couple hundred slots, slowing down shift signup.
Consider creating a join model for this, perhaps named signup, which belongs_to slot, :counter_cache -> true. This could grow a useful field or two, perhaps to mark no-show reason or something.