{"id":17621334,"url":"https://github.com/mansakondo/polymorphic_aliases","last_synced_at":"2025-09-14T07:31:31.599Z","repository":{"id":56888467,"uuid":"388109416","full_name":"mansakondo/polymorphic_aliases","owner":"mansakondo","description":"An ActiveRecord extension to use aliases for your polymorphic associations","archived":false,"fork":false,"pushed_at":"2022-06-12T19:58:29.000Z","size":54,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T20:55:39.037Z","etag":null,"topics":["activerecord","polymorphism","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/mansakondo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-21T12:28:09.000Z","updated_at":"2023-03-10T11:40:50.000Z","dependencies_parsed_at":"2022-08-20T16:00:30.938Z","dependency_job_id":null,"html_url":"https://github.com/mansakondo/polymorphic_aliases","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mansakondo/polymorphic_aliases","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mansakondo%2Fpolymorphic_aliases","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mansakondo%2Fpolymorphic_aliases/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mansakondo%2Fpolymorphic_aliases/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mansakondo%2Fpolymorphic_aliases/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mansakondo","download_url":"https://codeload.github.com/mansakondo/polymorphic_aliases/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mansakondo%2Fpolymorphic_aliases/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275076531,"owners_count":25401314,"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-09-14T02:00:10.474Z","response_time":75,"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","polymorphism","rails","ruby"],"created_at":"2024-10-22T20:29:41.212Z","updated_at":"2025-09-14T07:31:31.336Z","avatar_url":"https://github.com/mansakondo.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# polymorphic_aliases\nAn ActiveRecord extension to use aliases for your polymorphic associations.\n\n## Usage\nYour model code:\n```ruby    \n# app/models/comment.rb    \nclass Comment \u003c ApplicationRecord    \n  belongs_to :commentable, polymorphic: true, types: %w( Post Picture )    \nend    \n    \n# app/models/post.rb    \nclass Post \u003c ApplicationRecord    \n  has_many :comments, as: :commentable    \nend    \n    \n# app/models/picture.rb    \nclass Picture \u003c ApplicationRecord    \n  has_many :comments, as: :commentable    \nend\n```\nIn the console:\n```ruby\npost    = Post.create(title: \"Polymorphic Aliases\", content: \"...\")\npicture = Picture.create(legend: \"Here's my code.\", url: \"https://avatars.githubusercontent.com/u/47113995?v=4\")\n\ncomment_from_post    = Comment.create(content: \"...\", commentable: post)\ncomment_from_picture = Comment.create(content: \"...\", commentable: picture)\n\ncomment_from_post.post.title\n# =\u003e \"Polymorphic Aliases\"\n\ncomment_from_picture.picture.legend\n# =\u003e \"Here's my code.\"\n\ncomment_from_post.picture\n# =\u003e nil\n\ncomment_from_picture.post\n# =\u003e nil\n```\n\n## Installation\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"polymorphic_aliases\"\n```\n\nOr if you want to target the `main` branch:\n\n```ruby\ngem \"polymorphic_aliases\", github: \"mansakondo/polymorphic_aliases\"\n```\n\nAnd then execute:\n```bash\n$ bundle\n```\n\nOr install it yourself as:\n```bash\n$ gem install polymorphic_aliases\n```\n\n## Contributing\nContribution directions go here.\n\n## License\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmansakondo%2Fpolymorphic_aliases","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmansakondo%2Fpolymorphic_aliases","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmansakondo%2Fpolymorphic_aliases/lists"}