{"id":25725549,"url":"https://github.com/umar221b/filterable_model","last_synced_at":"2026-04-20T14:03:55.457Z","repository":{"id":56846424,"uuid":"240460451","full_name":"umar221b/filterable_model","owner":"umar221b","description":"FilterableModel provides an organized and seamless way to filter your ActiveRecord objects using real and custom attributes.","archived":false,"fork":false,"pushed_at":"2020-02-14T18:10:08.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-18T14:39:10.244Z","etag":null,"topics":["hacktoberfest","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/umar221b.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":"2020-02-14T08:21:48.000Z","updated_at":"2022-10-27T07:02:23.000Z","dependencies_parsed_at":"2022-09-09T01:00:29.552Z","dependency_job_id":null,"html_url":"https://github.com/umar221b/filterable_model","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/umar221b/filterable_model","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umar221b%2Ffilterable_model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umar221b%2Ffilterable_model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umar221b%2Ffilterable_model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umar221b%2Ffilterable_model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/umar221b","download_url":"https://codeload.github.com/umar221b/filterable_model/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umar221b%2Ffilterable_model/sbom","scorecard":{"id":908340,"data":{"date":"2025-08-11","repo":{"name":"github.com/umar221b/filterable_model","commit":"bb3a53890454a15364edd92661972989d53e4591"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/7 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-24T18:13:29.697Z","repository_id":56846424,"created_at":"2025-08-24T18:13:29.697Z","updated_at":"2025-08-24T18:13:29.697Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32050454,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["hacktoberfest","rails","ruby"],"created_at":"2025-02-25T22:30:40.326Z","updated_at":"2026-04-20T14:03:55.394Z","avatar_url":"https://github.com/umar221b.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FilterableModel\n\nFilterableModel provides an organized and seamless way to filter your ActiveRecord objects using real and custom attributes.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'filterable_model', '~\u003e 0.1.0'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install filterable_model\n\n## Usage\n\nInclude FilterableModel inside ApplicationRecord or directly inside your ActiveRecord model:\n\n```ruby\nclass User \u003c ApplicationRecord\n  include FilterableModel\nend\n```\n\n### Filtering by real attributes\n\nTo filter using the exact values of your ActiveRecord model attributes, override the `filterable_attributes` class method to return an array of whitelisted attributes:\n\n```ruby\nclass User \u003c ApplicationRecord\n  include FilterableModel\n\n  concerning :Filtering do\n    class_methods do\n\n      def filterable_attributes\n        %w[id gender is_subscribed]\n      end\n\n    end\n  end\n\nend\n```\n\n### Filtering by custom attributes\n\nFiltering using custom attributes works by calling the add_filter method and passing a block that accepts the filter-by value, and returns an `ActiveRecord::Relation`:\n\n```ruby\nclass User \u003c ApplicationRecord\n  include FilterableModel\n\n  concerning :Filtering do\n    included do\n\n      add_filter :name do |name| # search by first name or username\n        where(\"LOWER(users.first_name) LIKE :query OR LOWER(users.username) LIKE :query\", query: \"%#{name.downcase}%\")\n      end\n\n\n      add_filter :just_active do |value| # filter by users with active sessions\n        if value.to_s == 'true'\n          includes(:session).where(session: { active: true })\n        else\n          current_scope # do not change the current relation\n        end\n      end\n\n    end\n  end\nend\n```\n\nFilter your relation by calling `filter` on your model and passing the filtering hash:\n\n```ruby\n@users = User.all\n\nfiltering_hash = {\n  gender: 'male',\n  is_subscribed: 'false',\n  name: 'John',\n  just_active: 'true'\n}\n\n@users = @users.filter(filtering_hash)\n```\n\nPassing an unknown filter will raise a `FilterNotSupported` error.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/umar221b/filterable_model.\n\n## License\n\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%2Fumar221b%2Ffilterable_model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fumar221b%2Ffilterable_model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumar221b%2Ffilterable_model/lists"}