```ruby
module Api
  module V1
    class OrganizationsController < ApiController

      #These filters provide pagination info via HTTP Link headers
      #thanks to the 'api-pagination' gem
      after_filter only: [:index] { paginate(:orgs) }
      after_filter only: [:search] { paginate(:results) }

      caches :index, :show, :search, :caches_for => 5.minutes

      def index
        @orgs = Organization.page(params[:page]).per(30)
        expose @orgs
      end

      def show
        expose Organization.find(params[:id])
      end

      def nearby
        org = Organization.find(params[:id])
        expose org.nearbys(current_radius)
      end

      def search
        @results = org_search(params).all.page(params[:page]).per(30)
        begin
          expose @results
        rescue Moped::Errors::QueryFailure
          error! :bad_request,
                 :metadata => {
                   :specific_reason => "Invalid ZIP code or address"
                 }
        end
      end
    end
  end
end```

Add pagination to nearby endpoint
user
```ruby
module Api
  module V1
    class OrganizationsController < ApiController

      #These filters provide pagination info via HTTP Link headers
      #thanks to the 'api-pagination' gem
      after_filter only: [:index] { paginate(:orgs) }
      after_filter only: [:search] { paginate(:results) }
      after_filter only: [:nearby] { paginate(:nearby) }

      caches :index, :show, :search, :caches_for => 5.minutes

      def index
        @orgs = Organization.page(params[:page]).per(30)
        expose @orgs
      end

      def show
        expose Organization.find(params[:id])
      end

      def nearby
        org = Organization.find(params[:id])
        @nearby = org.nearbys(current_radius).page(params[:page]).per(30)
        expose @nearby
      end

      def search
        @results = org_search(params).all.page(params[:page]).per(30)
        begin
          expose @results
        rescue Moped::Errors::QueryFailure
          error! :bad_request,
                 :metadata => {
                   :specific_reason => "Invalid ZIP code or address"
                 }
        end
      end
    end
  end
end```
assistant