{"id":15151468,"url":"https://github.com/sampatbadhe/multi-db-app","last_synced_at":"2026-01-20T00:34:00.235Z","repository":{"id":72887566,"uuid":"442763897","full_name":"sampatbadhe/multi-db-app","owner":"sampatbadhe","description":"Rails 7 demo app for demonstrating associations across databases with disable_joins","archived":false,"fork":false,"pushed_at":"2022-01-28T10:16:34.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-13T12:53:43.747Z","etag":null,"topics":["rails7"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sampatbadhe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"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}},"created_at":"2021-12-29T12:19:46.000Z","updated_at":"2022-01-31T03:47:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"3b807bea-a626-4e8f-a89c-868cc80e49b3","html_url":"https://github.com/sampatbadhe/multi-db-app","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"ff34b237729b1d038c1535ac0fb8af5e44b8f83d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sampatbadhe%2Fmulti-db-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sampatbadhe%2Fmulti-db-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sampatbadhe%2Fmulti-db-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sampatbadhe%2Fmulti-db-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sampatbadhe","download_url":"https://codeload.github.com/sampatbadhe/multi-db-app/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247631258,"owners_count":20970036,"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":["rails7"],"created_at":"2024-09-26T15:03:37.957Z","updated_at":"2026-01-20T00:34:00.185Z","avatar_url":"https://github.com/sampatbadhe.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multi-Database Application\n\nSample Rails application for demonstrating [Rails 7 - Associations across databases with disable_joins](https://blog.kiprosh.com/rails7-association-across-databases-with-disable-joins/)\n\n* Ruby version: 2.7.1\n\n* Rails version: 7.0.0\n\n## Installation/Setup\n\n1. Clone the application on your local\n\n```\ngit clone https://github.com/sampatbadhe/multi-db-app.git\n```\n\n2. cd to the `passwordless-authentication-api` application directory\n\n```\n  cd multi-db-app\n```\n\n3. Run `bundle` command to install all gems\n\n```\n  bundle install\n```\n\n4. Configure your `database.yml` file.\n\n5. Run `bundle exec rails db:create`\n\n6. Run `bundle exec rails db:migrate`\n\n7. Run `bundle exec rails db:seed`. The sample data would be then loaded into application database.\n\n8. Run the rails console using `bundle exec rails console` or `bundle exec rails c`\n\n9. Run following operations and observe the queries.\n\n    - **Without `disable_joins` option**\n\n      We would have to add custom methods, as has_many :through/has_one :through associations won't work across databases.\n      ```ruby\n      # Set the user\n      \u003e user = User.find_by(email: 'luke@example.com')\n      # Fetch the messages of all the events of a user\n      \u003e user.event_messages\n      # Fetch the latest message on the latest event of a user\n      \u003e user.latest_event_message\n      ```\n\n    - **With `disable_joins` option**\n\n      ```ruby\n      # Set the user\n      \u003e user = User.find_by(email: 'luke@example.com')\n      # We can use `has_many :through` association to fetch the messages of all the events of a user\n      \u003e user.messages\n      # We can use `has_one :through` association to fetch the latest message on the latest event of a user\n      \u003e user.latest_message\n      ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsampatbadhe%2Fmulti-db-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsampatbadhe%2Fmulti-db-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsampatbadhe%2Fmulti-db-app/lists"}