fix department show deleted

dev_forum
p31729568 5 years ago
parent 08f374fede
commit e8b0866ff0

@ -1,6 +1,6 @@
class DepartmentsController < ApplicationController class DepartmentsController < ApplicationController
def for_option def for_option
render_ok(departments: current_school.departments.select(:id, :name).as_json) render_ok(departments: current_school.departments.without_deleted.select(:id, :name).as_json)
end end
private private

@ -2,4 +2,6 @@ class Department < ApplicationRecord
belongs_to :school belongs_to :school
has_many :department_members, dependent: :destroy has_many :department_members, dependent: :destroy
scope :without_deleted, -> { where(is_delete: false) }
end end

Loading…
Cancel
Save