{"id":16956994,"url":"https://github.com/jgraichen/decorate-responder","last_synced_at":"2026-01-22T08:33:15.255Z","repository":{"id":6865069,"uuid":"8113980","full_name":"jgraichen/decorate-responder","owner":"jgraichen","description":"A Rails responder to decorate resources.","archived":false,"fork":false,"pushed_at":"2022-06-28T16:25:33.000Z","size":26,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-21T07:37:12.565Z","etag":null,"topics":[],"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/jgraichen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-02-09T19:35:46.000Z","updated_at":"2022-06-29T06:26:31.000Z","dependencies_parsed_at":"2022-09-18T10:52:02.254Z","dependency_job_id":null,"html_url":"https://github.com/jgraichen/decorate-responder","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/jgraichen/decorate-responder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgraichen%2Fdecorate-responder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgraichen%2Fdecorate-responder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgraichen%2Fdecorate-responder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgraichen%2Fdecorate-responder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jgraichen","download_url":"https://codeload.github.com/jgraichen/decorate-responder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgraichen%2Fdecorate-responder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28659518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"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":[],"created_at":"2024-10-13T22:16:35.007Z","updated_at":"2026-01-22T08:33:15.239Z","avatar_url":"https://github.com/jgraichen.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Decorate::Responder [![Build Status](https://travis-ci.org/jgraichen/decorate-responder.png?branch=master)](https://travis-ci.org/jgraichen/decorate-responder)\n\nA Rails responder that will apply a decorator to a resource in the responder chain.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'decorate-responder'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install decorate-responder\n\nYou will also need a decorator gem like [draper](https://github.com/drapergem/draper) or your own decorator implementation.\n\n## Usage\n\nAdd `Responders::DecorateResponder` to your responder chain:\n\n```ruby\nclass AppResponder \u003c Responder\n  include Responders::DecorateResponder\nend\n\nclass MyController \u003c ApplicationController\n  self.responder = AppResponder\nend\n```\n\nOr use it with [plataformatec/responders](https://github.com/plataformatec/responders):\n\n```ruby\nclass MyController \u003c ApplicationController\n  responders Responders::DecorateResponder\nend\n```\n\nIf you're using a decorator gem such as [draper](https://github.com/drapergem/draper) that injects a `decorate` method into your resources they will get decorated automatically.\n\nWhen using draper, you may want to pass a [context hash](https://github.com/drapergem/draper#adding-context) from the controller to the decorator.\nYou can provide this context by adding a (public!) `decoration_context` method to the controller:\n\n```ruby\nclass AppController\n  responders Responder::DecorateResponder\n  \n  def decoration_context\n    { color: false }\n  end\nend\n```\n\nIf you want to build even more advanced decoration logic, you can also explicitly decorate your resources by adding a `decorate` method to your controller:\n\n```ruby\nclass AppController\n  responders Responders::DecorateResponder\n\n  def decorate(resource)\n  \tMyDecorator.new resource\n  end\nend\n```\n\nIf the resource and controller do not have a `decorate` method the resource will not be decorated.\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Add tests for your feature.\n4. Add your feature.\n5. Commit your changes (`git commit -am 'Add some feature'`)\n6. Push to the branch (`git push origin my-new-feature`)\n7. Create new Pull Request\n\n## License\n\n[MIT License](http://www.opensource.org/licenses/mit-license.php)\n\nCopyright (c) 2013, Jan Graichen\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgraichen%2Fdecorate-responder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjgraichen%2Fdecorate-responder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgraichen%2Fdecorate-responder/lists"}