jhund / filterrific

Filterrific is a Rails Engine plugin that makes it easy to filter, search, and sort your ActiveRecord lists.
http://filterrific.clearcove.ca
MIT License
910 stars 124 forks source link

Allow filters to be aliased on the controller side #184

Closed fooki closed 2 years ago

fooki commented 5 years ago

Available filterrific params can now be aliased on the controller side. This avoids conventional scope names on the model side with prefixes (e. g. by_property, for_property) in api parameters.

Example:

available_filters: [ sorted_by, { by_user: :user, by_comment: :comment }, ]

filters that are available becomes: by_user, user, by_comment, comment

The filterrific params user and comment will now be renamed to by_user and bycomment and the api avoids the by prefix. The sorted_by filter remains unchanged.