{"id":26656345,"url":"https://github.com/elisebastian/rails_location_header","last_synced_at":"2026-03-01T04:03:33.738Z","repository":{"id":284242444,"uuid":"954293221","full_name":"EliSebastian/rails_location_header","owner":"EliSebastian","description":"Rails gem that automatically adds X-Entity-ID and Location headers when a new record is successfully created in a create action. ","archived":false,"fork":false,"pushed_at":"2025-04-22T03:34:46.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-08T17:58:33.239Z","etag":null,"topics":["gem","http","lib","library","rails","rails-api","ruby"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/rails_location_header","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/EliSebastian.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-24T21:26:29.000Z","updated_at":"2025-04-22T03:34:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"943a7625-dd00-48c0-893e-55f9ac6f69f6","html_url":"https://github.com/EliSebastian/rails_location_header","commit_stats":null,"previous_names":["elisebastian/rails_location_header"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/EliSebastian/rails_location_header","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EliSebastian%2Frails_location_header","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EliSebastian%2Frails_location_header/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EliSebastian%2Frails_location_header/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EliSebastian%2Frails_location_header/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EliSebastian","download_url":"https://codeload.github.com/EliSebastian/rails_location_header/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EliSebastian%2Frails_location_header/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":283910072,"owners_count":26915128,"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-11-11T02:00:06.610Z","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":["gem","http","lib","library","rails","rails-api","ruby"],"created_at":"2025-03-25T07:19:40.298Z","updated_at":"2025-11-11T19:02:53.088Z","avatar_url":"https://github.com/EliSebastian.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RailsLocationHeader\n\nRailsLocationHeader is a Rails gem that automatically adds `X-Entity-ID` and `Location` headers when a new record is successfully created in a `create` action. This helps in providing additional metadata about the created resource in API responses.\n\n## Installation\n\nAdd this gem to your application's Gemfile by executing:\n\n```bash\nbundle add rails_location_header\n```\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n```bash\ngem install rails_location_header\n```\n\n## Usage\n\nTo use this gem, include it in your Rails application. The gem automatically integrates with Rails controllers via a Railtie and works out of the box.\n\n### How It Works\n\n1. **`create` action with a 201 status**: The `create` action must return an HTTP `201 Created` status.\n2. **Instance variable**: Declare an instance variable in the `create` action that matches the entity name (e.g., `@post` in `PostsController`).\n3. **`show` action and route**: Ensure the controller has a `show` action and a corresponding route to construct the resource's URL.\n\n### Headers Added\n\nWhen the above requirements are met, the gem automatically adds the following headers to the response:\n\n- `X-Entity-ID`: The ID of the created resource.\n- `Location`: The URL of the created resource.\n\nNo additional configuration is needed.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. 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:\n\n```bash\nbundle exec rake install\n```\n\nTo release a new version, update the version number in `lib/rails_location_header/version.rb`, and then run:\n\n```bash\nbundle exec rake release\n```\n\nThis will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at [https://github.com/EliSebastian/rails_location_header](https://github.com/EliSebastian/rails_location_header). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/EliSebastian/rails_location_header/blob/main/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the RailsLocationHeader project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [code of conduct](https://github.com/EliSebastian/rails_location_header/blob/main/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felisebastian%2Frails_location_header","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felisebastian%2Frails_location_header","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felisebastian%2Frails_location_header/lists"}