class Student < ApplicationRecord
filterrific(
default_filter_params: { sort_by: 'lastname_asc' },
available_filters: [
:sort_by,
:with_lastname
]
)
end
controller:
def index
@filterrific = initialize_filterrific(
Student,
params[:filterrific]
) or return
@students = @filterrific.find.page(params[:page])
# @students = Student.where(deleted: false)
respond_to do |format|
format.html
format.js
end
end
I've followed the stacktrace this far: In filterrific (2.1.2) lib/filterrific/active_record_extension.rb:69:inblock in filterrific_find'` the following line fails:
ar_rel = ar_rel.send(filter_name, filter_param)
filter_name has the value "sort_by" and filter_param is "lastname_asc", but ar_rel#sort_by has an arity of 0.
Hi! Hope you can help me!
rails 5.1.4 filterrific 2.1.2 will_paginate 3.1.6
model:
controller:
index.html.erb:
_list.html.erb:
When I navigate to
/students
now, i instantly get this error:wrong number of arguments (given 1, expected 0)
with the following stacktrace:I've followed the stacktrace this far: In
filterrific (2.1.2) lib/filterrific/active_record_extension.rb:69:in
block in filterrific_find'` the following line fails:filter_name
has the value"sort_by"
andfilter_param
is"lastname_asc"
, butar_rel#sort_by
has an arity of0
.Is this a bug or am I doing something wrong?