Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add counter_cache to slot #15

Open
flwyd opened this issue Jul 15, 2013 · 0 comments
Open

Add counter_cache to slot #15

flwyd opened this issue Jul 15, 2013 · 0 comments

Comments

@flwyd
Copy link
Member

flwyd commented Jul 15, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant