{"id":14955834,"url":"https://github.com/cimon-io/susanin","last_synced_at":"2025-09-29T23:32:01.608Z","repository":{"id":32896748,"uuid":"36491340","full_name":"cimon-io/susanin","owner":"cimon-io","description":"Extend `polymorphic_url` to replace simple resource with array of resources.","archived":false,"fork":true,"pushed_at":"2021-12-29T12:20:19.000Z","size":34,"stargazers_count":15,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-26T13:20:52.263Z","etag":null,"topics":["activesupport","billet","routes","ruby","ruby-gem","ruby-on-rails","rubyonrails"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"aratak/susanin","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cimon-io.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":"2015-05-29T08:27:47.000Z","updated_at":"2021-12-29T12:20:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/cimon-io/susanin","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cimon-io%2Fsusanin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cimon-io%2Fsusanin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cimon-io%2Fsusanin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cimon-io%2Fsusanin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cimon-io","download_url":"https://codeload.github.com/cimon-io/susanin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219865577,"owners_count":16554161,"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":["activesupport","billet","routes","ruby","ruby-gem","ruby-on-rails","rubyonrails"],"created_at":"2024-09-24T13:11:52.737Z","updated_at":"2025-09-29T23:31:56.324Z","avatar_url":"https://github.com/cimon-io.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Susanin\n\nExtend `polymorphic_url` to replace simple resource with array of resources.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'susanin'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install susanin\n\n## Usage\n\nBy default gems do nothing. Include module 'susanin' to the controller.\n\n```ruby\nclass ApplicationController \u003c ActionController::Base\n  include ::Susanin\n\n  susanin do\n    [\n      [:owner,              -\u003e(r) { [:admin] }],\n      [[:frontend, Link],   -\u003e(r) { [:frontend, r] }],\n      [User,                -\u003e(r) { [:owner, r] }],\n      [Project,             -\u003e(r) { [:owner, r] }],\n      [Link,                -\u003e(r) { [:owner, r] }],\n      [Admin,               -\u003e(r) { [r.company, r] }],\n      [Photo,               -\u003e(r) { [r.admin.company, r.admin, r] }],\n      [Gallery,             -\u003e(r) { [r.company, r] }]\n    ]\n  end\n\nend\n```\n\nThen you're able to call `link_to` method wihtout knowlege about the nested resources inside `routes.rb`. Instead of this:\n\n```ruby\nlink_to user.email, [:edit, user.company, user], class: 'button'\n```\n\nYou are able to write this:\n\n```ruby\nlink_to user.email, [:edit, user], class: 'button'\n```\n\n## Contributing\n\n1. Fork it ( https://github.com/[my-github-username]/susanin/fork )\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 a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcimon-io%2Fsusanin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcimon-io%2Fsusanin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcimon-io%2Fsusanin/lists"}