activerecord-hackery / ransack

Object-based searching.
https://activerecord-hackery.github.io/ransack/
MIT License
5.66k stars 799 forks source link

Raising ArgumentError exception on Ransack operations #1460

Open moretoend opened 10 months ago

moretoend commented 10 months ago

Currently, when something goes wrong with some of Ransack operations of Searching and Sorting, it raises an ArgumentError exception.

There is a sample on the docs:

Article.ransack(unknown_attr_eq: 'Ernie')
# ArgumentError (Invalid search term unknown_attr_eq)

I`m proposing here to change it to a custom error specific for Ransack operations because this error is a Ruby internal one specific for missing arguments on a method call.

Besides that, Ransack users will tend to rescue this error to render a response to the end user and it may lead us to a bad error supression.

moretoend commented 10 months ago

I myself would like to work on it = )

scarroll32 commented 10 months ago

Please go ahead @dfmoreto !

moretoend commented 7 months ago

@scarroll32 I think it's done. I've opened the PR #1478 with the resolution = )