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

Feature: Counter cache #88

Open
endel opened this issue Jul 16, 2014 · 2 comments
Open

Feature: Counter cache #88

endel opened this issue Jul 16, 2014 · 2 comments
Labels

Comments

@endel
Copy link
Contributor

endel commented Jul 16, 2014

Allow belongs_to relationships to cache the number of related rows.

Like Rails: http://apidock.com/rails/ActiveRecord/Associations/ClassMethods/belongs_to

@endel endel added the feature label Jul 16, 2014
@endel
Copy link
Contributor Author

endel commented Jul 17, 2014

YAML relationship configs will looks like this:

authors:
  relationships:
    has_many:
      - posts
    counter_cache:
      - posts

posts:
  relationships:
    belongs_to: authors

@endel
Copy link
Contributor Author

endel commented Feb 24, 2015

As we're discussing on #130, the counter cache feature may be defined like this:

authors:
  has_many: 
    - posts:
        counter_cache: true # creates a field with name "books_count"

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

No branches or pull requests

1 participant