• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sleede / fab-manager / #106

pending completion
#106

push

coveralls-ruby

sylvainbx
Merge branch 'dev' for release 6.0.0

704 of 704 new or added lines in 168 files covered. (100.0%)

7919 of 13474 relevant lines covered (58.77%)

15.29 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/controllers/api/plan_categories_controller.rb
1
# frozen_string_literal: true
2

3
# API Controller for resources of type PlanCategory
4
# PlanCategory are used to sort plans
5
class API::PlanCategoriesController < API::APIController
×
6
  before_action :authenticate_user!, except: :index
×
7
  before_action :set_category, only: %i[show update destroy]
×
8

9
  def index
×
10
    @categories = PlanCategory.order(weight: :desc)
×
11
  end
×
12

13
  def show; end
×
14

15
  def create
×
16
    authorize PlanCategory
×
17

18
    @category = PlanCategory.new(plan_category_params)
×
19
    if @category.save
×
20
      render :show, status: :created, location: @category
×
21
    else
×
22
      render json: @category.errors, status: :unprocessable_entity
×
23
    end
×
24
  end
×
25

26
  def update
×
27
    authorize @category
×
28
    if @category.update(plan_category_params)
×
29
      render :show, status: :ok
×
30
    else
×
31
      render json: @category.errors, status: :unprocessable_entity
×
32
    end
×
33
  end
×
34

35
  def destroy
×
36
    authorize @category
×
37
    @category.destroy
×
38
    head :no_content
×
39
  end
×
40

41
  private
×
42

43
  def set_category
×
44
    @category = PlanCategory.find(params[:id])
×
45
  end
×
46

47
  def plan_category_params
×
48
    params.require(:plan_category).permit(:name, :weight, :description)
×
49
  end
×
50
end
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc