I would do two things to reorganize this ...
First, to reduce the connection by moving the pagination parameters to the class method on the design model. Your controller should not know about this model.
class Design < ActiveRecord::Base
def self.paginate_with_params(params, per_page)
paginate(:page => params[:page], :order => 'name', :per_page => per_page)
end
end
Secondly, remove unnecessary variables and logic from your controller that do not really add much value:
@category = Category.find(params[:id])
@designs = @category.sub_categories.map |sub_cat|
sub_cat.designs.paginate_with_params(params, @per_page)
end
, , , , :)