class Api::V1::SchoolsController < Api::V1::BaseController
  respond_to :json, :xml

  def index
    scope = School
    scope = scope.by_city(params[:city].downcase) if params[:city].present?
    scope = scope.by_state(params[:state].downcase) if params[:state].present?
    scope = scope.by_query(params[:q]) if params[:q].present?

    @schools = scope.paginate(page: params[:page], per_page: params[:per_page])
    respond_with(paginate @schools)
  end

end


