Sha256: c7b7f0a9a3e79600b56f5f8be9e1703232b887d902cc4c4bb521bb562463370c

Contents?: true

Size: 436 Bytes

Versions: 20

Compression:

Stored size: 436 Bytes

Contents

module Gaku
  class SearchController < GakuController

    respond_to :json, only: :search

    def students
      if params[:class_name]
        object = "Gaku::#{params[:class_name].classify}".constantize
        @result = object.order(params[:column].to_sym)
                        .where(params[:column] + ' like ?', "%#{params[:term]}%")
        render json: @result.map(&params[:column].to_sym).uniq
      end
    end

  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
gaku_frontend-0.3.0 app/controllers/gaku/search_controller.rb
gaku_frontend-0.3.0.pre.4 app/controllers/gaku/search_controller.rb
gaku_frontend-0.3.0.pre.3 app/controllers/gaku/search_controller.rb
gaku_frontend-0.3.0.pre.2 app/controllers/gaku/search_controller.rb
gaku_frontend-0.3.0.pre.1 app/controllers/gaku/search_controller.rb
gaku_frontend-0.3.0.pre.0 app/controllers/gaku/search_controller.rb
gaku-0.2.4 frontend/app/controllers/gaku/search_controller.rb
gaku_frontend-0.2.4 app/controllers/gaku/search_controller.rb
gaku-0.2.3 frontend/app/controllers/gaku/search_controller.rb
gaku_frontend-0.2.3 app/controllers/gaku/search_controller.rb
gaku-0.2.2 frontend/app/controllers/gaku/search_controller.rb
gaku_frontend-0.2.2 app/controllers/gaku/search_controller.rb
gaku-0.2.1 frontend/app/controllers/gaku/search_controller.rb
gaku_frontend-0.2.1 app/controllers/gaku/search_controller.rb
gaku-0.2.0 frontend/app/controllers/gaku/search_controller.rb
gaku_frontend-0.2.0 app/controllers/gaku/search_controller.rb
gaku-0.1.1 frontend/app/controllers/gaku/search_controller.rb
gaku_frontend-0.1.1 app/controllers/gaku/search_controller.rb
gaku-0.1.0 frontend/app/controllers/gaku/search_controller.rb
gaku_frontend-0.1.0 app/controllers/gaku/search_controller.rb