{"full_name":"activerecord-hackery/ransack","owner":"activerecord-hackery","name":"ransack","shard":"1","url":"https://github.com/activerecord-hackery/ransack","description":"Search everywhere and in a hurry!","homepage":"https://activerecord-hackery.github.io/ransack/","topics":["search","search-interface","ruby","ruby-gem","ruby-library","ruby-on-rails","activerecord","sql","rails"],"tag_pages":["rails","ruby","ruby-on-rails","search","sql"],"language":"Ruby","license":"MIT","avatar":"https://avatars.githubusercontent.com/u/5951504?v=4","created_at":"2011-03-31T00:34:25Z","pushed_at":"2026-11-14T11:09:35Z","metrics":{"stars":5858,"forks":822,"watchers":78,"issues":983,"prs":791,"releases":51,"issues_open":1,"issues_closed":982,"prs_open":0,"prs_closed":200,"prs_merged":591,"discussions":19},"growth":{"day":{"stars":0,"forks":0,"base_day":"2026-11-15"}},"history":{"dates":["2026-11-10","2026-11-11","2026-11-12","2026-11-13","2026-11-14","2026-11-15","2026-11-16"],"stars":[5857,5858,5859,5859,5858,5858,5858],"forks":[822,822,822,822,822,822,822],"watchers":[null,78,78,78,78,78,78],"issues_open":[null,1,1,1,1,1,1],"prs_open":[null,0,0,0,1,0,0]},"boards":{},"same_owner":[],"issues":[{"number":1799,"title":"Uncomment the case-insensitive SQLite table spec once rails/rails#59671 is merged","comments":2,"created_at":"2026-11-08T14:35:56Z"}],"discussions":[{"number":1761,"title":"Efficiency of generated SQL for has_many *_not_eq","comments":0,"category":"General","created_at":"2026-10-15T14:56:24Z"},{"number":1743,"title":"v6.0.0","comments":0,"category":"Announcements","created_at":"2026-10-09T17:55:18Z"},{"number":1668,"title":"Question: how do you feel about a new method to know if ransackable_attributes is defined?","comments":0,"category":"Q&A","created_at":"2026-03-19T23:42:23Z"},{"number":1630,"title":"4.4.0","comments":0,"category":"General","created_at":"2025-09-25T00:12:59Z"},{"number":1560,"title":"Recommended way to do `IS DISTINCT FROM`, `not_eq_or_null` or `not_cont_or_null`","comments":0,"category":"Q&A","created_at":"2025-05-20T01:10:01Z"},{"number":1530,"title":"How to merge search results?","comments":0,"category":"Q&A","created_at":"2024-10-03T20:01:26Z"},{"number":1524,"title":"How to Filter a Subquery in Ransack Without Affecting Performance?","comments":0,"category":"Q&A","created_at":"2024-09-11T20:48:26Z"},{"number":1509,"title":"ends_with changes the characters reaching the database","comments":1,"category":"General","created_at":"2024-07-25T21:44:28Z"}],"latest_release":{"name":"v6.1.0","tag":"v6.1.0","published_at":"2026-11-08T18:31:55Z","body":"\n## Security\n\n- **Includes the `sort_link` / `sort_url` fix released as 6.0.1.** Request params were passed to `url_for`, so a crafted query string such as `?script_name=javascript:...` made sort links run script in the app's origin or point to another site (reflected XSS and open redirect). Ransack now drops `url_for`'s URL options (`script_name`, `host`, `protocol`, `only_path`, ...) from the params it carries into the link. GHSA-58rx-96gf-w92x.\n\n## Compatibility\n\n- **Ruby 3.3 or later and Rails 8.1 or later are required.** Ruby 3.2 reached end of life on 2026-03-31, Rails 7.2 on 2026-08-09 and Rails 8.0 on 2026-11-07; none of them receives security fixes. Nothing else changes, so on a supported Ruby and Rails the upgrade needs no code changes. On Ruby 3.2 or Rails 8.0 or earlier, stay on 6.0. — #1756, #1786\n\n## Features\n\n- **`add_predicate` takes `arel_node:`**, a callable that receives the attribute and the cast value and returns a finished Arel node, so a custom predicate can combine conditions without monkey patching `Arel::Predications`:\n\n  ```ruby\n  config.add_predicate 'gteq_or_null',\n    arel_node: ->(attr, val) { attr.gteq(val).or(attr.eq(nil)) }\n  ```\n\n  It can't be combined with `arel_predicate`, has no `_any` / `_all` forms, and must return an `Arel::Nodes::Node` (anything else raises `ArgumentError`). The result is normalized like a built-in predicate's, and works with `null_sentinel`. — #1789 by @agrberg\n\n## Bug fixes\n\nNegative predicates on a collection (`articles_title_not_eq`, `tags_name_not_in`, `notes_note_not_cont`, ...) are built as a correlated subquery. 6.1 fixes how that subquery is built and which joins come with it:\n\n- **Calling `result` twice, or putting two negative conditions on the same collection, no longer raises `NoMethodError`** (`undefined method 'table' for nil`). This was a regression in 6.0.0: `search.result` followed by `search.result.order_values`, a pair of conditions like `articles_title_not_eq` plus `articles_body_not_cont`, or an `_or_` attribute all failed. — #1746, fixes #1745\n- **The subquery reaches the same records the association does.** It used to keep only the foreign-key correlation and drop the rest of the join, so it counted rows the association doesn't reach, and returned wrong records without raising:\n  - the type column of a polymorphic `has_many ... as:`: a note on another model with the same id excluded the record\n  - the target's default scope: a comment hidden by `default_scope` still excluded the record\n  - the STI type column and the association's own scope\n  - an association with a `primary_key:` option produced invalid SQL; it's now tested on that column\n\n  — #1751, fixes #1747\n- **A join something else in the search reads is kept.** A sort on the same collection (`s: 'articles_title asc'`, e.g. from a `sort_link`), or a condition or sort on an association nested under it (`articles_comments_body_eq`), referenced a join the negative condition had dropped (`no such column`). The join now stays alongside the subquery. — #1752, fixes #1749\n- **A search can be changed after `result` and evaluated again.** Evaluating a search no longer changes it. A sort or condition added afterwards used to reference a dropped join, or an alias (`articles_people`) the query didn't have. The joins come from the search as it stands when it is evaluated, so clearing a sort or condition also drops its join instead of leaving one behind to repeat records. — #1753, fixes #1750\n- **Every collection on the model gets the subquery.** It was only built when the attribute name started with the collection's table name, so an STI subclass (`story_articles_title_not_eq`), a scoped association (`published_articles_title_not_eq`) or one named differently from its table fell back to a join with a row-level `!=`, and returned records that do have a matching row. — #1783, fixes #1773\n\nJoins a search adds now line up with the joins the relation already has:\n\n- **A condition nested under an eager-load","is_prerelease":false},"readme":true,"readme_zh":false,"news":[],"stale":false,"snapshot_at":"2026-11-16T09:23:14Z","history_start":"2026-09-06"}