From b5ffc58d10859540f2e6aac857a791340bc0a3e3 Mon Sep 17 00:00:00 2001 From: Jasder <2053003901@@qq.com> Date: Thu, 19 Dec 2019 10:18:11 +0800 Subject: [PATCH] ADD ignores api --- app/controllers/ignores_controller.rb | 5 +++++ app/models/ignore.rb | 1 + app/views/ignores/index.json.jbuilder | 1 + config/routes.rb | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 app/controllers/ignores_controller.rb create mode 100644 app/views/ignores/index.json.jbuilder diff --git a/app/controllers/ignores_controller.rb b/app/controllers/ignores_controller.rb new file mode 100644 index 000000000..2afe28e27 --- /dev/null +++ b/app/controllers/ignores_controller.rb @@ -0,0 +1,5 @@ +class IgnoresController < ApplicationController + def index + @ignores = Ignore.search(params[:name]).without_content + end +end diff --git a/app/models/ignore.rb b/app/models/ignore.rb index 91c743735..bd75ed08c 100644 --- a/app/models/ignore.rb +++ b/app/models/ignore.rb @@ -1,2 +1,3 @@ class Ignore < ApplicationRecord + include Projectable end diff --git a/app/views/ignores/index.json.jbuilder b/app/views/ignores/index.json.jbuilder new file mode 100644 index 000000000..a60ea7006 --- /dev/null +++ b/app/views/ignores/index.json.jbuilder @@ -0,0 +1 @@ +json.ignores @ignores, :id, :name diff --git a/config/routes.rb b/config/routes.rb index a24a9d658..e58d43b86 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,4 @@ Rails.application.routes.draw do - get 'project_languages/index' require 'sidekiq/web' require 'admin_constraint' mount Sidekiq::Web => '/sidekiq', :constraints => AdminConstraint.new @@ -25,6 +24,7 @@ Rails.application.routes.draw do resources :project_categories, only: [:index, :show] resources :project_languages, only: [:index, :show] + resources :ignores, only: [:index, :show] # resources :memos do # member do