Skip to content

Add counter_cache to slot #15

@flwyd

Description

@flwyd

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions