kirlev
kirlev

Reputation: 700

filter numeric type as string in activeadmin

I want to add a filter to activeadmin's index page that can filter records by ID, but the default filter options for numeric attributes are equals/greater than/less than while I need the default options for a string attribute contains/equals/starts with/ends with.

I've tried filter :id, as: :string but that raises error when filtering.

How can I implement such a filter in activeadmin?

Upvotes: 2

Views: 1542

Answers (1)

Fivell
Fivell

Reputation: 11929

this works for me

 filter :id_eq, as: :string, label: 'Id'

Upvotes: 4

Related Questions