{"id":15405132,"url":"https://github.com/fnando/touch","last_synced_at":"2025-10-06T23:48:32.934Z","repository":{"id":9655849,"uuid":"11593265","full_name":"fnando/touch","owner":"fnando","description":"Touch a parent's collection on ActiveRecord.","archived":false,"fork":false,"pushed_at":"2018-12-27T04:59:58.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-06T23:48:32.199Z","etag":null,"topics":["activerecord","caching","rails","timestamp"],"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/fnando.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}},"created_at":"2013-07-22T21:45:54.000Z","updated_at":"2018-12-27T05:00:30.000Z","dependencies_parsed_at":"2022-09-24T05:41:38.433Z","dependency_job_id":null,"html_url":"https://github.com/fnando/touch","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/fnando/touch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Ftouch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Ftouch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Ftouch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Ftouch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fnando","download_url":"https://codeload.github.com/fnando/touch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Ftouch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278698808,"owners_count":26030398,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["activerecord","caching","rails","timestamp"],"created_at":"2024-10-01T16:15:10.157Z","updated_at":"2025-10-06T23:48:32.919Z","avatar_url":"https://github.com/fnando.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Touch\n\n[![Travis-CI](https://travis-ci.org/fnando/touch.svg)](https://travis-ci.org/fnando/touch)\n[![Code Climate](https://codeclimate.com/github/fnando/touch/badges/gpa.svg)](https://codeclimate.com/github/fnando/touch)\n[![Test Coverage](https://codeclimate.com/github/fnando/touch/badges/coverage.svg)](https://codeclimate.com/github/fnando/touch/coverage)\n[![Gem](https://img.shields.io/gem/v/touch.svg)](https://rubygems.org/gems/touch)\n[![Gem](https://img.shields.io/gem/dt/touch.svg)](https://rubygems.org/gems/touch)\n\nTouch a parent's collection on ActiveRecord.\n\n## Why not just using `belongs_to :assoc, touch: true`?\n\nThe option provided by `belongs_to` will refresh the `updated_at` column only. With this gem, you can can have a fine control for each association, making caching easier.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem \"touch\"\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install touch\n\n## Usage\n\nImagine you have to models:\n\n```ruby\nclass User \u003c ActiveRecord::Base\n  has_many :things\nend\n\nclass Thing \u003c ActiveRecord::Base\n  belongs_to :user\n  touch :user\nend\n```\n\nThis new `ActiveRecord::Base.touch` method updates the `User#things_updated_at` attribute every time a new `Thing` is created, updated or removed.\n\nIt also updates the parent's `updated_at` field, just like `belongs_to :user, touch: true` configuration.\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnando%2Ftouch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffnando%2Ftouch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnando%2Ftouch/lists"}