{"id":18544444,"url":"https://github.com/instructure/guardrail","last_synced_at":"2025-04-05T22:04:33.383Z","repository":{"id":7738416,"uuid":"9105115","full_name":"instructure/guardrail","owner":"instructure","description":"ActiveRecord extension to allow multiple database environments (secondary, deploy) enabling least privilege when possible.","archived":false,"fork":false,"pushed_at":"2025-03-21T23:49:34.000Z","size":68,"stargazers_count":17,"open_issues_count":5,"forks_count":15,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-03-29T21:03:13.391Z","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/instructure.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2013-03-29T19:29:24.000Z","updated_at":"2025-02-24T21:10:34.000Z","dependencies_parsed_at":"2024-01-25T20:24:46.006Z","dependency_job_id":"5ee35b80-dd40-4664-8008-f277173f244d","html_url":"https://github.com/instructure/guardrail","commit_stats":{"total_commits":53,"total_committers":9,"mean_commits":5.888888888888889,"dds":"0.39622641509433965","last_synced_commit":"5a6344c96f2f09461decd814d9f289c095fa1949"},"previous_names":["instructure/shackles"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instructure%2Fguardrail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instructure%2Fguardrail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instructure%2Fguardrail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instructure%2Fguardrail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/instructure","download_url":"https://codeload.github.com/instructure/guardrail/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406085,"owners_count":20933803,"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-06T20:16:34.815Z","updated_at":"2025-04-05T22:04:33.359Z","avatar_url":"https://github.com/instructure.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"GuardRail\n==========\n\n## About\n\nGuardRail is a thin wrapper around Rail 6.1's native role switching.\n\n## Installation\n\nAdd `gem 'guardrail'` to your Gemfile.\n\n## Usage\n\nSee https://guides.rubyonrails.org/active_record_multiple_databases.html. GuardRail simply adds\nsyntactic sugar to easily switch to different roles:\n\n\n```ruby\ndef some_method\n  GuardRails.activate(:secondary) do\n    MyModel.some_really_long_query\n  end\nend\n```\n\nAdditionally you can include GuardRail::HelperMethods and use several helpers\nto execute methods on specific environments:\n\n```ruby\nclass SomeModel\n  include GuardRail::HelperMethods\n\n  def expensive_read_only\n    ...\n  end\n  guard_rail_method :expensive_read_only, environment: :replica\n\n  def self.class_level_expensive_read_only\n    ...\n  end\n  guard_rail_class_method :class_level_expensive_read_only, environment: :replica\n\n  # helpers for multiple methods are also available\n\n  guard_rail_methods :instance_method_foo, :instance_method_bar, environment: :replica\n  guard_rail_class_methods :class_method_foo, :class_method_bar, environment: :replica\nend\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finstructure%2Fguardrail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finstructure%2Fguardrail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finstructure%2Fguardrail/lists"}