I'd like to create an activeadmin filter on a page for a model that has an association with the User model. I'd like to use the custom scope matches_name, which combines the first_name and last_name fields. I've added that scope to the model's ransackable_scopes method, and I am able to query it in the rails console.
I've specified the filter like so:
filter :user_matches_name, as: :string, label: "User"
However, when I load the page, it errors out with this message:
undefined method `user_matches_name_contains' for Ransack::Search<class: MyModel, base: Grouping <combinator: and>>:Ransack::Search
I've been able to create a filter on the user activeadmin page without a similar error:
filter :matches_name, as: :string, label: "User"
Is there a way to prevent either ransack or activeadmin from appending the extra _contains on the end of the filter?
:user_matches_name_user_matches_namefilter :user_name_matches, as: :string, label: "User"and add that as aransackable_scopeor better yet maybe create a custom ransacker and utilize that.