{"id":23096756,"url":"https://github.com/jetrockets/activerecord-update_counters_with_values","last_synced_at":"2026-05-09T09:53:42.032Z","repository":{"id":70073526,"uuid":"140888853","full_name":"jetrockets/activerecord-update_counters_with_values","owner":"jetrockets","description":"Update ActiveRecord counter and update instance value","archived":false,"fork":false,"pushed_at":"2019-01-15T19:57:36.000Z","size":14,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-02-09T08:19:21.976Z","etag":null,"topics":["active-record","activerecord","hacks","rails","ruby","ruby-on-rails"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jetrockets.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-13T20:10:01.000Z","updated_at":"2019-01-15T19:57:26.000Z","dependencies_parsed_at":"2023-02-28T07:45:58.844Z","dependency_job_id":null,"html_url":"https://github.com/jetrockets/activerecord-update_counters_with_values","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetrockets%2Factiverecord-update_counters_with_values","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetrockets%2Factiverecord-update_counters_with_values/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetrockets%2Factiverecord-update_counters_with_values/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetrockets%2Factiverecord-update_counters_with_values/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jetrockets","download_url":"https://codeload.github.com/jetrockets/activerecord-update_counters_with_values/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247070928,"owners_count":20878586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["active-record","activerecord","hacks","rails","ruby","ruby-on-rails"],"created_at":"2024-12-16T22:48:13.570Z","updated_at":"2026-05-09T09:53:36.991Z","avatar_url":"https://github.com/jetrockets.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ActiveRecord::UpdateCountersWithValues\n\nUpdate ActiveRecord counter and update instance value\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'activerecord-update_counters_with_values', require: 'active_record/update_counters_with_values'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install activerecord-update_counters_with_values\n\n## Usage\n\n```ruby\nclass MyModel \u003c ActiveRecord::Base\n  include Activerecord::UpdateCountersWithValues\n\n  #...\nend\n```\n\n### Class methods\n\n```ruby\nMyModel.update_counters_and_return_values(1, comments_count: 1)\nMyModel.update_counters_and_return_values(1, comments_count: 1, another_count: 2)\nMyModel.update_counters_and_return_values([1,2], comments_count: 1, another_count: 2)\n\nMyModel.increment_counter_and_return_value(1, :comments_count)\nMyModel.decrement_counter_and_return_value(1, :comments_count)\n```\n\n### Instance methods\n\n```ruby\ndocument = Document.first\ndocument.update_counters_with_values(comments_count: 1)\ndocument.update_counters_with_values(comments_count: 1, another_count: 2)\n\ndocument.increment_counter_with_value(:comments_count)\ndocument.decrement_counter_with_value(:comments_count)\n```\n\n## Credits\n\nSponsored by [JetRockets](http://www.jetrockets.pro).\n\n![JetRockets](http://jetrockets.pro/JetRockets.jpg)\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjetrockets%2Factiverecord-update_counters_with_values","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjetrockets%2Factiverecord-update_counters_with_values","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjetrockets%2Factiverecord-update_counters_with_values/lists"}