You could setup an around filter that would automatically paginate and filter your model entities.
class MyController < ApplicationController
around_filter SearchFilter.new(:products, :search_string), :only => :list
around_filter PagintationFilter.new(:products, 20), :only => :list
def list
@products = Product.find(:all)
end
end
Those could be wrapped in some kind of DSL (class methods).
The problem with similar sorting filter is that AR::Base::with_scope doesn't allow :order param.
Комментариев нет:
Отправить комментарий