{"id":19221098,"url":"https://github.com/ledermann/redundant_links","last_synced_at":"2025-02-23T09:26:41.696Z","repository":{"id":446654,"uuid":"69295","full_name":"ledermann/redundant_links","owner":"ledermann","description":"Automatic handling of a join table for indirect (transitive) associations.","archived":false,"fork":false,"pushed_at":"2011-04-10T06:05:08.000Z","size":116,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-15T18:54:22.354Z","etag":null,"topics":[],"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/ledermann.png","metadata":{"files":{"readme":"README","changelog":null,"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":"2008-10-29T16:31:14.000Z","updated_at":"2019-08-13T13:40:05.000Z","dependencies_parsed_at":"2022-07-07T14:41:45.023Z","dependency_job_id":null,"html_url":"https://github.com/ledermann/redundant_links","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ledermann%2Fredundant_links","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ledermann%2Fredundant_links/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ledermann%2Fredundant_links/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ledermann%2Fredundant_links/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ledermann","download_url":"https://codeload.github.com/ledermann/redundant_links/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240295252,"owners_count":19778857,"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":[],"created_at":"2024-11-09T14:40:03.217Z","updated_at":"2025-02-23T09:26:41.662Z","avatar_url":"https://github.com/ledermann.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"redundant_links\n===============\n\nAutomatic handling of a join table for indirect associations\nPlugin for Ruby on Rails 2.1 (or newer)\n\n\nExample\n=======\n\nAssume you have contacts who can place multiple orders. In addition, contacts \nand orders may have multiple notes. This plugin helps you to get the notes\nof a contact, even if they belong to one of its orders. This is just a simple\nexample. Of course it works in more complex situations, too.\n\nclass Contact \u003c ActiveRecord::Base\n  has_many :orders\n  has_many :notes, :as =\u003e :object\nend\n\nclass Order \u003c ActiveRecord::Base\n  belongs_to :contact\n  has_many :notes, :as =\u003e :object\nend\n\nclass Note \u003c ActiveRecord::Base\n  belongs_to :object, :polymorphic =\u003e true\n  \n  has_redundant_links Note    =\u003e :object, \n                      Order   =\u003e :contact, \n                      Contact =\u003e nil\nend\n\n\ncontact = Contact.find(123)\n\nNow you can do:\n\nWith plain Rails magic:\ncontact.notes\n=\u003e Gives you only the notes which directly belong to the contact\n\nWith this plugin:\ncontact.redundant_linked_notes\n=\u003e Gives you the notes which either directly belong to the contact or \n   belong to orders of this contact\n\n\nHow it works\n============\n\nThe plugin manages a join table named \"redundant_links\" with all direct and\nindirect associations between a detail model and defined master models. It\ncreates an instance method in all of the master models to get the linked\ndetail records (based on a simple INNER JOIN, so it's quite fast).\n\n\nInstallation\n============\n\nscript/plugin install git://github.com/ledermann/redundant_links.git\nscript/generate redundant_link_migration add_redundant_links_table\nrake db:migrate\n\n\nUsage\n=====\n\nIn your detail model place this\n  has_redundant_links(options)\n\nSee the source code for more information about the options hash.\n\n\nToDo\n====\n\n- Some optimizations, so updating join table records is only made if it's needed\n\nCopyright (c) 2008 Georg Ledermann, released under the MIT license","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fledermann%2Fredundant_links","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fledermann%2Fredundant_links","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fledermann%2Fredundant_links/lists"}