I would highly recommend you push this back into your model if you need it in both places. This seems like business logic, which belongs in the model.
class Person < ActiveRecord::Base
… your other stuff
def self.filter_by_name_and_address(name, address)
name = "#{name}%"
address = "#{address}%"
self.find(:all, conditions=>["name like ? and address like ?", name, address
end
end
Your controller might be like this now:
def list @person_pages, @people = paginate Person.filter_by_name_and_address(params[:name], params[:address]), per_page => 50
end
That’s untested, btw, but it should get you going in the right direction. Helpers are really for code that is directly related to views and controllers. You want to try to keep as much db stuff in the model as you can. You might have a compelling reason to use the helper as you’d originally intended, so my apologies if this is not suitable for you.