0
votes

I have a class method on a model class that filters the records based on an attribute that is not part of the schema (but derived from its attributes):

def filter(records, some_param)
  records.select { |rec| rec.param > some_param } # param is a derived attribute
end

I am calling it from controller. The problem is I need to paginate the results of this filtering and my project uses 'kaminari' plugin thatr paginates only the ActiveRecord::Relation output. How do I get ActiveRecord::Relation out of an array?

1

1 Answers

1
votes

If you mean kaminari, then:

Kaminari.paginate_array(my_array_object).page(params[:page]).per(10)