I faced the following error when running filtering using ransack:
ArgumentError wrong number of arguments (given 1, expected 0)
and stack trace is showing this:
object.ransack(query_params)
When dug deeper I have found that the error appears in aasm_create_scope method from the aasm gem.
query_params = {accepted: "value"}
What could go wrong?
The problem was that
acceptedis a scope provided byaasmwhich doesn't accept arguments. Ransack doesn't send an argument when the value istrueor ignore the scope when it is set tofalse.would only make sense. Any other value will raise that error.