{"id":23479558,"url":"https://github.com/Rails-Designer/stealth_dom_id","last_synced_at":"2025-08-27T07:31:29.728Z","repository":{"id":261026883,"uuid":"883050091","full_name":"Rails-Designer/stealth_dom_id","owner":"Rails-Designer","description":"Extends Rails' `dom_id` helper to support custom attribute-based identifiers","archived":true,"fork":false,"pushed_at":"2025-05-26T04:47:56.000Z","size":35,"stargazers_count":22,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-26T08:59:06.792Z","etag":null,"topics":["gem","rails","ruby"],"latest_commit_sha":null,"homepage":"","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/Rails-Designer.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":"2024-11-04T09:42:45.000Z","updated_at":"2025-08-08T17:49:21.000Z","dependencies_parsed_at":"2024-12-24T19:30:36.556Z","dependency_job_id":"3270ea28-2eb9-4a2b-a307-d6d8690c6a9a","html_url":"https://github.com/Rails-Designer/stealth_dom_id","commit_stats":{"total_commits":14,"total_committers":2,"mean_commits":7.0,"dds":0.2857142857142857,"last_synced_commit":"dca4561926d42010b674fa07af3b62ca4d55f023"},"previous_names":["rails-designer/stealth_dom_id"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Rails-Designer/stealth_dom_id","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rails-Designer%2Fstealth_dom_id","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rails-Designer%2Fstealth_dom_id/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rails-Designer%2Fstealth_dom_id/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rails-Designer%2Fstealth_dom_id/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rails-Designer","download_url":"https://codeload.github.com/Rails-Designer/stealth_dom_id/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rails-Designer%2Fstealth_dom_id/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272304643,"owners_count":24910603,"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-08-27T02:00:09.397Z","response_time":76,"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":["gem","rails","ruby"],"created_at":"2024-12-24T19:30:29.198Z","updated_at":"2025-08-27T07:31:29.720Z","avatar_url":"https://github.com/Rails-Designer.png","language":"Ruby","readme":"# stealth_dom_id\n\n\u003e [!IMPORTANT]\n\u003e This gem is sunsetted. The [suggested solution and replacement is outlined in this article](https://railsdesigner.com/dom-id-without-primary-id/).\n\nstealth_dom_id extends Rails' [`dom_id`](https://github.com/rails/rails/blob/main/actionview/lib/action_view/record_identifier.rb) helper by allowing you to generate DOM IDs using any attribute instead of the default database primary keys. This helps keep your internal database IDs private.\n\n## Installation\n\nAdd the gem to your application's Gemfile by running:\n```bash\nbundle add stealth_dom_id\n```\n\n## Usage\n\nInstead of exposing database IDs in your HTML elements with the standard `dom_id` helper:\n```erb\n\u003c%= dom_id(@user) %\u003e\n# =\u003e \"user_1\"\n```\n\nYou can use any available attribute of your choice:\n```erb\n\u003c%= dom_id(@user, attribute: :public_id) %\u003e\n# =\u003e \"user_a1b2c3\"\n```\n\nThe `attribute` parameter is optional and defaults to the model's primary key. Just like Rails' built-in `dom_id`, you can also include a prefix:\n```erb\n\u003c%= dom_id(@user, :admin, attribute: :public_id) %\u003e\n# =\u003e \"admin_user_a1b2c3\"\n```\n\n### Configuration\n\nYou can set a default attribute to be used across your application. Add this to an initializer (e.g., `config/initializers/stealth_dom_id.rb`):\n```ruby\nStealthDomId.configure do |config|\n  config.default_attribute = :public_id\nend\n```\n\nNow `public_id` will be used whenever no specific attribute is provided.\n\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRails-Designer%2Fstealth_dom_id","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRails-Designer%2Fstealth_dom_id","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRails-Designer%2Fstealth_dom_id/lists"}