title: will_paginate not working, returning an error of undefined method `total_pages'
body: <p>I am trying to paginate microposts. I use the following :
      &lt;%= will_paginate @user.microposts %>
  But it returns an error of :
  undefined method `total_pages' for #
  Please help
  My controller method is as follows : </p>
  
  <pre><code>class UsersController &lt; ApplicationController
    before_filter :signed_in_user, only: [:index,:edit, :update]
    before_filter :correct_user, only: [:edit, :update]
    before_filter :admin_user, only: :destroy
    def index
      @users = User.paginate(page: params[:page])
      @microposts = @user.microposts.paginate(page: params[:page])
    end
    def new
       @user = User.new
    end
    def show
       @user = User.find(params[:id])
    end
    def destroy
      User.find(params[:id]).destroy
      flash[:success] = "User destroyed."
      redirect_to users_path
    end
    def update
      @user = User.find(params[:id])  
      if params[:user].present? &amp;&amp;    @user.update_attributes(params.require(:user).permit(:name,:password,  :password_confirmation))
     flash[:success] = "Profile updated"
     sign_in @user
     redirect_to @user
     else
      render 'edit'
     end
    end
  
  
    def edit
      @user = User.find(params[:id])  
      if params[:user].present? &amp;&amp;    @user.update_attributes(params.require(:user).permit(:name,:password, :password_confirmation))
      flash[:success] = "Profile updated"
      sign_in @user
      redirect_to @user
      else
       render 'edit'
      end
     end
  
    def create
      @user=  User.create(user_params)
      if @user.save
      sign_in @user
      flash[:success] = "Welcome to the Sample App!"
      redirect_to @user
      else
       render 'new'
      end
     end
  
  
     private
       def user_params
         params.require(:user).permit(:password, :password_confirmation,   :email,:name)
       end 
     private
       def signed_in_user
        unless signed_in?
        store_location
        redirect_to signin_path, notice: "Please sign in." 
       end
      end
    def correct_user
      @user = User.find(params[:id])
      redirect_to(root_path) unless current_user?(@user)
    end
   end  
  </code></pre>