I have such code
@pre_articles = Article.find(:all, :conditions => { :ART_ID => @linkla.map(&:LA_ART_ID)})
@articles = Kaminari.paginate_array(@pre_articles).page(params[:page]).per(15)
It's selecting for me array of data, but it's huge, so i decided to add pagination. It select's 15 entries for view, but also for every page (in log) i see, how sql is selecting all array as in first @pre_articles. For more speed: how to select on every page for example 0-15, 15-30, 30-45 etc entries and send it for view? now it's selecting all data, but dislpaying as i need
Oh sorry, important!:
@linkla = LinkArt.where(:LA_ID => @la_typs.map(&:LAT_LA_ID), :LA_GA_ID => @genart.map(&:GA_ID))
@articles = Article.where(:ART_ID => @linkla.map(&:LA_ART_ID)).page(params[:page]).per(15)
So looks my query. As you see depending on @linkla results i select articles, and link la is selecting many as before... how to do that he select only for my page