Topic: Problems with will_paginate while refactoring a custom finder

Hello, i need to select items from an array. For example an user have many languages, so i need to filter users based on languages. I have made this

class Array

  def allowed(paginate = false)
    self.empty? ? self : select {|x| x.c_languages.any?{|x| x.code == Locale.active.language.code.downcase} }
end


So that, i can call something like User.find(:all).allowed. The problem starts when i try to use that method with the will_paginate plugin because the paginate method create a WillPaginate.collection instance, but my method return an object of class Array. I think this can turn out in to my model, but I don't know wxactly how to do. Thanks in advance for anything that can help me with it

Re: Problems with will_paginate while refactoring a custom finder

i've found a solution myself, thanks again