How to display two differents models in my view with will_paginate in rails? -


hi have question , looking on google don't find answer. i'm want display post model , user model search in same page , want use will_paginate display of them . i try solution =>

  **require 'will_paginate/array'   @posts =post.search(params[:q]).order("created_at desc")   @users=user.search(params[:q]).order("created_at desc")     @all_records = (@posts + @users).paginate(:page =>params[:page], :per_page => 10)** 

and in view want display query found ,so try =>

 **<%unless @posts.nil?%>   <% @posts.each |post| %>   .... ** **<% unless @users.nil?%> <% @users.each |user| %> ...** <%= will_paginate @all_records %> 

but doesn't work nothing happend, want know how @posts , @users records in @all_records => **

<% @all_records[@posts].each do.. %> <% @all_records[@usets].each ..%> 

** saw solutions suggest use 2 differentes paginate in view =>

**<%= will_paginate @posts %> <%= will_paginate @users %>** 

**but it's not want want , would'like 1 paginate all, please me cause i'm going crazy, thank **


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -