{"id":29287383,"url":"https://github.com/fabrikatorio/sortiri","last_synced_at":"2025-09-04T05:36:57.984Z","repository":{"id":56896495,"uuid":"326272356","full_name":"fabrikatorio/sortiri","owner":"fabrikatorio","description":"Sortiri is a clean and lightweight solution for making ActiveRecord::Base objects sortable","archived":false,"fork":false,"pushed_at":"2021-01-02T21:16:31.000Z","size":13,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-12T21:05:35.370Z","etag":null,"topics":["activerecord","ruby","ruby-gem","ruby-on-rails","sort","sql"],"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/fabrikatorio.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":"2021-01-02T21:15:55.000Z","updated_at":"2022-11-05T06:58:36.000Z","dependencies_parsed_at":"2022-08-21T01:50:10.909Z","dependency_job_id":null,"html_url":"https://github.com/fabrikatorio/sortiri","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fabrikatorio/sortiri","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabrikatorio%2Fsortiri","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabrikatorio%2Fsortiri/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabrikatorio%2Fsortiri/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabrikatorio%2Fsortiri/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabrikatorio","download_url":"https://codeload.github.com/fabrikatorio/sortiri/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabrikatorio%2Fsortiri/sbom","scorecard":{"id":390578,"data":{"date":"2025-08-11","repo":{"name":"github.com/fabrikatorio/sortiri","commit":"e7345cfa93aa100db3b5483e6d4a897bd456651c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2,"checks":[{"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":"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":"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/1 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":"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":"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":"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":"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":"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":"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"}},{"name":"Vulnerabilities","score":0,"reason":"15 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-3hhc-qp5v-9p2j","Warn: Project is vulnerable to: GHSA-579w-22j4-4749","Warn: Project is vulnerable to: GHSA-76r7-hhxj-r776","Warn: Project is vulnerable to: GHSA-8hc4-xxm3-5ppp","Warn: Project is vulnerable to: GHSA-hq7p-j377-6v63","Warn: Project is vulnerable to: GHSA-cr5q-6q9f-rq6q","Warn: Project is vulnerable to: GHSA-j6gc-792m-qgm2","Warn: Project is vulnerable to: GHSA-pj73-v5mw-pm9j","Warn: Project is vulnerable to: GHSA-2rxp-v6pw-ch6m","Warn: Project is vulnerable to: GHSA-4xqq-m2hx-25v8","Warn: Project is vulnerable to: GHSA-5866-49gr-22v4","Warn: Project is vulnerable to: GHSA-8cr8-4vfw-mr7h","Warn: Project is vulnerable to: GHSA-r55c-59qm-vjw6","Warn: Project is vulnerable to: GHSA-vg3r-rm7w-2xgh","Warn: Project is vulnerable to: GHSA-vmwr-mc7x-5vc3"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T17:42:21.727Z","repository_id":56896495,"created_at":"2025-08-18T17:42:21.727Z","updated_at":"2025-08-18T17:42:21.727Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273556353,"owners_count":25126561,"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-04T02:00:08.968Z","response_time":61,"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","ruby","ruby-gem","ruby-on-rails","sort","sql"],"created_at":"2025-07-06T01:07:12.403Z","updated_at":"2025-09-04T05:36:57.945Z","avatar_url":"https://github.com/fabrikatorio.png","language":"Ruby","readme":"# Description\n\nSortiri is a clean and lightweight solution for making ActiveRecord::Base objects sortable.\n\n## Getting started\n\nSortiri is supported for ActiveRecord 4.2+ on Ruby 2.6.0 and later.\n\nIn your Gemfile, for the last officially released gem:\n\n```ruby\ngem 'sortiri'\n```\n\n## Usage\n\nTo add Sortiri to an ActiveRecord::Base object, simply include the Sortiri module.\n\n```ruby\nclass User \u003c ActiveRecord::Base\n  include Sortiri::Model\nend\n```\n\n### Ascending\n\nSorting is ascending by default and can be reversed by adding a hyphen (-) to the start of the property name.\n\n```ruby\n# GET /users?sort=name\n\nclass User \u003c ActiveRecord::Base\n  include Sortiri::Model\n\n  sortable against: %i[name age weight], default_sort: 'age'\nend\n\n# users will be sorted by name and ascending (A -\u003e Z)\n```\n\n### Descending\n\nTo sort by descending, simply add a hypen (-) to the start of the property name.\n\n```ruby\n# GET /users?sort=-name\n\nclass User \u003c ActiveRecord::Base\n  include Sortiri::Model\n\n  sortable against: %i[name age weight], default_sort: 'age'\nend\n\n# users will be sorted by name and descending (Z -\u003e A)\n```\n\n### Default sort option\n\nIt is mandatory to provide a default sort option for the model. If nothing is passed, the default sort option will be applied.\n\n```ruby\n# GET /users\n\nclass User \u003c ActiveRecord::Base\n  include Sortiri::Model\n\n  sortable against: %i[name age weight], default_sort: '-age'\nend\n\n# users will be sorted by age and descending\n```\n\n### Sorting through associations\n\nIt is possible to sort columns on associated models.\n\nYou can pass a Hash into the :associated_against option to set up sorting through associations. The keys are the names of the associations and the value works just like an :against option for the other model. Right now, sorting deeper than one association away is not supported.\n\n```ruby\nclass Company \u003c ActiveRecord::Base\n  has_many :users\nend\n\n# GET /users?sort=-company.name\n\nclass User \u003c ActiveRecord::Base\n  include Sortiri::Model\n\n  belongs_to :company\n\n  sortable against: %i[name age weight], associated_against: { company: [:name] }, default_sort: '-age'\nend\n\n# users will be sorted by their companies name and descending (Z -\u003e A)\n```\n\n### Controller\n\n#### Sorted\n\nAllows to specify an order string.\n\n```ruby\nclass UsersController \u003c ApplicationController\n  def index\n    @users = User.sorted(params[:sort])\n  end\nend\n```\n\n#### Sorted!\n\nReplaces any existing order defined on the relation with the specified order.\n\n```ruby\nclass UsersController \u003c ApplicationController\n  def index\n    if params[:sort].present?\n        @users = User.sorted!(params[:sort])\n    else\n        @users = User.sorted(params[:sort])\n    end\n  end\nend\n```\n\n### Sortiri's sort_link helper creates table headers that are sortable links\n\nTo use Sortiri's sort_link helper, simply include the Sortiri module on your ApplicationHelper.\n\n```ruby\nmodule ApplicationHelper\n  include Sortiri::ViewHelpers::TableSorter\nend\n```\n\n```erb\n\u003c%= sort_link(@users, :name, 'First Name') %\u003e\n```\n\n```haml\n= sort_link @users, :name, 'First Name'\n```\n\nAdditionally css classes can be passed after the title attribute.\n\n```erb\n\u003c%= sort_link(@users, :name, 'First Name', 'd-flex justify-content-center') %\u003e\n```\n\n```haml\n= sort_link @users, :name, 'First Name', 'd-flex justify-content-center'\n```\n\n### Configuration\n\nSortiri uses default up and down arrows for the view helper. This may be changed by\nsetting them in a Sortiri initializer file (typically `config/initializers/sortiri.rb`):\n\n```ruby\nSortiri.configure do |c|\n  c.up_arrow = 'fas fa-angle-up'\n  c.down_arrow = 'fas fa-angle-down'\nend\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/fabrikatorio/sortiri.\n\n## License\n\nCopyright © 2019–2021 [Fabrikatör](https://fabrikator.io).\n\nLicensed under the MIT license, see [License](https://github.com/fabrikatorio/sortiri/blob/master/LICENSE.txt).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabrikatorio%2Fsortiri","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabrikatorio%2Fsortiri","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabrikatorio%2Fsortiri/lists"}